Returns the status of the given bit in an integer value
bit(19, 1)
Returns the value of bit 1 (the second bit) in the value 19.
19 (decimal) written as binary is 10011
.
Thus, bit 4, 1 and 0 are set. Bit 0 is the first from the right.
value | The input value (64 bit integer) |
bitno | The bit number to return |
Returns 1 if the bit is set. 0 if the bit is not set.
bit(211, 5) // returns 0 bit(211, 4) // returns 1
[Available in firmware 201008 and newer]