updating oE bits_to_int
bits_to_int
include convert.e namespace convert public function bits_to_int(sequence bits)
converts a sequence of bits to an atom that has no fractional part.
Parameters:
- bits : the sequence to convert.
Returns:
A positive atom, whose machine representation was given by bits.
Comments:
An element in bits can be any atom. If nonzero, it counts for 1, else for 0.
The first elements in bits represent the bits with the least weight in the returned value. Only the 52 last bits will matter, as the PC hardware cannot hold an integer with more digits than this.
If you print s the bits will appear in "reverse" order, but it is convenient to have increasing subscripts access bits of increasing significance.
Example 1:
a = bits_to_int({1,1,1,0,1}) -- a is 23 (binary 10111)
See Also:
Not Categorized, Please Help
|