bits_to_int

Definition: atom a = bits_to_int(sequence s)
Description: Convert a sequence of binary 1s and 0s into a positive number. The least-significant bit is s[1].
Comments: 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:
a = bits_to_int({1,1,1,0,1})
-- a is 23 (binary 0b10111, hex #17)
See Also: int_to_bits, sequence operations