✔ Appearance ✔ Standard ✔ Console
bitValue = bit( bitPos )
This function returns an integer whose binary representation has the bit in position
bitPos set to "1", and all other bits set to "0". Bit positions are counted from right to left: a
bitPos value of zero corresponds to the rightmost ("least significant") bit. The maximum allowable value for
bitPos is 31, which corresponds to the leftmost bit in a long-integer value.
bit is useful in conjunction with "bitwise operators" like
or, for setting and testing the values of particular bits in a quantity.
The following expression evaluates as
_zTrue (-1) if bit "n" is set in
( testValue& and bit( n ) ) <> 0
The following assignment sets bit "n" in
testValue& to 1:
testValue& = ( testValue& or bit( n ) )
The following assignment resets bit "n" in
testValue& to 0:
testValue& = ( testValue& and not bit( n ) )
_bitPos is a symbolic constant name, then you can use
_bitPos% (note the "%") as a synonym for
bit( _bitPos ).