bit_flip
Flip (toggle) the bit at position pos of the number n (0 becomes 1, 1 becomes 0).
bit_flip(
n,
pos,
[format="dec"],
[zeropad=0]
) -> NUMBER
Flip (toggle) the bit at position pos of the number n (0 becomes 1, 1 becomes 0).
Syntaxe
var n = bit_flip(145,0);
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 |