bit_zeros
Counts leading or trailing zero bits in n within specified width.
bit_zeros(
n,
leading,
[width=8]
) -> NUMBER
Counts leading or trailing zero bits in n within specified width.
Syntaxe
var leading = bit_zeros(8, true); // Uses default width\nvar trailing = bit_zeros("0b1000", false, 0); // Auto-detect
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
n | yes | - | Number (int/float), hex string (0x... #...), or binary string (0b...) | |
leading | yes | - | If true count leading zeros, else trailing | |
width | - | 8 | Bit width (8, 16, 32, 64...), or 0 for auto-detect |