Trait dashu_int::ops::PowerOfTwo
source · [−]pub trait PowerOfTwo {
fn is_power_of_two(&self) -> bool;
fn next_power_of_two(self) -> Self;
}
Expand description
Next power of two.
Examples
use dashu_base::PowerOfTwo;
let n = 5u32;
assert!(!n.is_power_of_two());
assert_eq!(n.next_power_of_two(), 8);