[−][src]Function hilbert::normalize::smallest_power_of_two
pub fn smallest_power_of_two<N>(n: N) -> usize where
N: Into<u64>,
Smallest power of two such that two raised to that power is greater than or equal to the given number.
n
- Find the smallest power of two that equals or exceeds this value.- Returns - The power, not the number (unlike u64::next_power_of_two, which returns the number, not its log base 2).
Examples:
- smallest_power_of_two(7) returns 3, because 2^3 = 8 which is greater than 7.
- smallest_power_of_two(16) returns 4, because 2^4 = 16 which is equal to 16.