bit_mask
Creates a bitmask with bits set in the range [low, high] inclusive.
bit_mask(
low,
high,
[format="dec"],
[zeropad=0]
) -> NUMBER
Creates a bitmask with bits set in the range [low, high] inclusive.
Syntaxe
var mask = bit_mask(2, 4); // Returns 28 (binary 11100)
Arguments
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
low | yes | - | Lowest bit position (inclusive) | |
high | yes | - | Highest bit position (inclusive) | |
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 |