bit_get
Return the bit at position pos of the number n (in binary).
bit_get(
n,
pos,
[format="dec"],
[zeropad=0]
) -> NUMBER (0 or 1)
Return the bit at position pos of the number n (in binary).
Syntaxe
var b = bit_get(145,2);
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
n | yes | - | Number (int/float), hex string (0x... #...), or binary string (0b...) | |
pos | yes | - | Position | |
format | - | "dec" | Output format: 'dec', 'hex', or 'bin' | |
zeropad | - | 0 | Zero-pad hex/bin output to this width in bits (8, 16, 32, 64), 0 for no padding |