zorch.utils.bits¶
Bit/log helpers for power-of-two sized data.
log2_strict_usize ¶
log2_strict_usize(n: int) -> int
Exact log2 of a power of two; raises ValueError otherwise.
Source code in zorch/utils/bits.py
11 12 13 14 15 | |
log2_ceil_usize ¶
log2_ceil_usize(n: int) -> int
ceil(log2 n); 0 for n <= 1.
Source code in zorch/utils/bits.py
18 19 20 21 22 | |