Trait core::num::UnsignedIntStable
[-] [+]
[src]
pub trait UnsignedInt: Int { fn is_power_of_two(self) -> bool { ... } fn next_power_of_two(self) -> Self { ... } fn checked_next_power_of_two(self) -> Option<Self> { ... } }
A built-in unsigned integer.
Provided Methods
fn is_power_of_two(self) -> bool
Returns true
iff self == 2^k
for some k
.
fn next_power_of_two(self) -> Self
Returns the smallest power of two greater than or equal to self
.
Unspecified behavior on overflow.
fn checked_next_power_of_two(self) -> Option<Self>
Returns the smallest power of two greater than or equal to n
. If the
next power of two is greater than the type's maximum value, None
is
returned, otherwise the power of two is wrapped in Some
.
Implementors
impl UnsignedInt for usize
impl UnsignedInt for u8
impl UnsignedInt for u16
impl UnsignedInt for u32
impl UnsignedInt for u64