BITTEST()

BITTEST()

Top  Previous  Next

 

The BITTEST() function tests the state of a specified bit in an integer value.

 

 

Format

 

BITTEST(expr, bit)

 

where

 

exprevaluates to the value in which the bit is to be tested.

 

bitevaluates to the bit position (0 to 31).

 

The BITTEST() function converts expr to a 32 bit integer and tests the state of the bit identified by bit, returning True if it is set and False if it is reset. Bits are numbered from 0 to 31 from the least significant end of the value. The effect of this function with a bit value outside this range is undefined.

 

 

Example

 

IF BITTEST(FLAGS, 2) THEN DISPLAY(IT$CS) :

 

This statement clears the screen if bit 2 is set in the FLAGS variable.

 

 

See also:

BITAND(), BITNOT(), BITOR(), BITRESET(), BITSET(), BITXOR(), SHIFT()