Module twenty_first::shared_math::other
source · [−]Functions
Convert a number to an array showing which bits are set in its bit representation
Count bits required to represent an unsigned number. Inspired by and similar to
BigInteger’s bits()
method.
Simultaneously perform division and remainder.
Compute the number of nodes (used as capacity) in a complete binary tree from the number of leaves.
Check if the number is a power of two: { 1,2,4 .. } [Bit Twiddling Hacks]: https://graphics.stanford.edu/~seander/bithacks.html#DetermineIfPowerOf2
Round up to the nearest power of 2
Extended Euclid’s Algorithm.