GET_BIT
Use the GET_BIT script function to convert a number into a binary format, resulting in a bit field. The script function checks if the bit is set in a specified position.
Syntax
GET_BIT (Number, Bit Position)
Parameters
-
GET_BIT
Script function that checks if a bit is set in a bit field
Return code: 0 if the bit is set, 1 if the bit is not set -
Number
Number to convert into a binary format (bit field)
Format: number or script variable -
Bit Position
Position within a bit field to check, always counted from the right
Format: script literal, script variable or number specified without quotation marks
Examples
In the following example, the script function checks whether the third bit is set in the bit field (110). The bit field in this example is the binary format of the number 6. The script also outputs the returned value (1, the bit set) to the activation report.
:SET &RET# = GET_BIT(6, 3)
:PRINT &RET#
See also: