getbit(
NUMBER
,
BIT
)

The getbit( function returns the value of a bit within a number.


Parameters

This function has two parameters:

number – an integer value.

bit – the bit number to test, may be from 1 to 64.


Description

This function returns a true or false value by testing a bit within a number. The bit number may be from 1 to 64. If the bit is set, the returned value will be true (-1), if it is not set, the returned value will be false (0).

getbit(5,1) ☞ -1 (true)
getbit(5,2) ☞ 0 (false)
getbit(5,3) ☞ -1 (true)
getbit(5,4) ☞ 0 (false)

Note: This function is equivalent to:

(bit(bitnum) and thenum) <> 0

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, but now supports up to 64 bits (instead of 32).