DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


EncodeBin

Declaration: EncodeBin(value: integer): integer;
The function EncodeBin returns the position of the first (less significant) bit which is set in the parameter value. The least significant bit (LSB) has the position 0, the most significant bit (MSB) the position 31.

The following figure explains a call to EncodeBin(1024). The number 1024 has bit 10 set to one, all other bits are zero. Thus the function returns the value 10 because the lowest bit which is not zero is at position 10: