Skip to main content

next_power_of_two

Function next_power_of_two 

Source
pub const fn next_power_of_two(n: u64) -> u64
Expand description

Smallest power of two >= n. Returns 0 for n == 0.

ยงExamples

use mathverse_core::integer::next_power_of_two;

assert_eq!(next_power_of_two(5), 8);
assert_eq!(next_power_of_two(8), 8);