bitget
Read a specific bit of an integer value.
Syntax
Section titled “Syntax”B = bitget(A, bit)B = bitget(A, bit, type)Description
Section titled “Description”Returns the value (0 or 1) of the bit at position bit in A. bit is 1-based — 1 selects the least significant bit. The optional type string controls how A is interpreted as an integer (defaults to int64). A and bit are broadcast to a common shape.
Examples
Section titled “Examples”bitget(10, 2) % 1 (10 = 1010, bit 1 is 1)bitget(10, 1) % 0bitget(255, 1:8) % [1 1 1 1 1 1 1 1]