Module checked_arithmetics

Source

Functionsยง

checked_int_div
Division implementation that fails in case when a`` isn't divisible by b`
checked_log_2
log2 implementation that fails when val is not a power of 2.
log2_ceil_usize
Computes the binary logarithm of $n$ rounded up to the nearest integer.
log2_strict_usize
Computes log_2(n)
min_bits
Returns the number of bits needed to represent $n$.
strict_log_2
Computes binary logarithm of val. If val is not a power of 2, returns None.