bit_not
Returns the bitwise NOT of n, masked to the minimal bit width needed to represent n, or specified width.
bit_not(
n,
[width=8],
[format="dec"],
[zeropad=0]
) -> NUMBER
Returns the bitwise NOT of n, masked to the minimal bit width needed to represent n, or specified width.
Syntaxe
var result = bit_not(171); // Returns 84 (8-bit, since 171 < 256)\nvar result2 = bit_not(171, 16); // Returns 65484 (forced 16-bit)\nvar result3 = bit_not(0); // Returns 0 (edge case)
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
n | yes | - | Number (int/float), hex string (0x... #...), or binary string (0b...) | |
width | - | 8 | Bit width (8, 16, 32, 64...), or 0 for auto-detect | |
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 |