pub trait PowerOfTwo {
    fn is_power_of_two(&self) -> bool;
    fn next_power_of_two(self) -> Self;
}
Expand description

Functions related to the 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);

Required Methods

Test if self is a power of two (2^k)

Get the smallest power of two greater than or equal to self.

Implementations on Foreign Types

Implementors