GetBit
Returns the value of the specified bit (1 to 32).
Syntax
GetBit(x, bitNumber)
Parameters
Parameter |
Type |
Description |
---|---|---|
x |
number |
Numeric value. |
bitNumber |
number |
1-based bin number. 1 is the least significant bit, 32 is the most significant bit |
Return
Returns the value (0 or 1) of the specified bit.
Note
The first parameter is converted to an unsigned 32-bit integer and then the bit value of this unsigned integer is returned.
Examples
Python
import nex
# get the second bit of 3
b2 = nex.GetBit(3, 2)
# b2 is now equal to 1
NexScript
% get the second bit of 3
b2 = GetBit(3, 2)
% b2 is now equal to 1