The _READBIT function is used to check the state of a specified bit of a integer value.
- result = _READBIT(numericalVariable, numericalValue)
- numericalVariable is the variable to read the state of a bit of and can be of the following types: _BYTE, INTEGER, LONG, or _INTEGER64.
- Integer values can be signed or _UNSIGNED.
- numericalValue the number of the bit to be read.
- Used to check the current state of a bit in an integer value.
- Returns -1 if the bit is set(1), otherwise returns 0 if the bit is not set(0)
- Bits start at 0 (so a _BYTE has bits 0 to 7, INTEGER 0 to 15, and so on)
- Version 1.4 and up.
A~%% = _SETBIT(A~%%,4) PRINT "Bit 4 is currently "; IF _READBIT(A~%%,4) = -1 THEN PRINT "ON" ELSE PRINT "OFF" PRINT "And bit 2 is currently "; IF _READBIT(A~%%,2) = -1 THEN PRINT "ON" ELSE PRINT "OFF"
Bit 4 is currently ON And bit 2 is currently OFF
B& = 12589575 B& in binary is: 00000000110000000001101000000111