Macro that returns the value of one bit of an integer
Syntax
Usage
result = Bit(value, bit_number)
Parameters
value
Value in which to test the bit.
bit_number
Zero-based number of the bit to test, where 0 is the least-significant bit.
Return Value
-1 if bit bit_number is set in value, else 0.
Description
Bit returns -1 if the bit bit_number of value is 1, returns 0 if bit is 0.
foo = Bit( bar, 10 ) is the same as foo = (bar and 1 shl 10) <> 0.
Example
Print Bit(4,2)
Print Bit(5,1)
Print Bit(&H8000000000000000ULL,63)
will produce the output:
-1
0
-1
Dialect Differences
Differences from QB
See also