Skip to content

Math

Some simple math-related utility functions not present in the standard library.

trailing_zeros(value: int) -> int

Returns the number of trailing zeros in the binary representation of the given integer.

next_power_of_two(value: int) -> int

Returns the smallest power of two that is greater than or equal to the given integer.