Trait malachite_base::num::arithmetic::traits::IsPowerOf2
source · [−]pub trait IsPowerOf2 {
fn is_power_of_2(&self) -> bool;
}
Expand description
Determines whether a number is an integer power of 2.
Required Methods
fn is_power_of_2(&self) -> bool
Implementations on Foreign Types
sourceimpl IsPowerOf2 for u8
impl IsPowerOf2 for u8
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for u16
impl IsPowerOf2 for u16
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for u32
impl IsPowerOf2 for u32
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for u64
impl IsPowerOf2 for u64
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for u128
impl IsPowerOf2 for u128
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for usize
impl IsPowerOf2 for usize
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
This is a wrapper over the is_power_of_two
functions in the standard library, for
example this one.
sourceimpl IsPowerOf2 for f32
impl IsPowerOf2 for f32
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
Determines whether a number is an integer power of 2.
$f(x) = (\exists n \in \Z : 2^n = x)$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.
sourceimpl IsPowerOf2 for f64
impl IsPowerOf2 for f64
sourcefn is_power_of_2(&self) -> bool
fn is_power_of_2(&self) -> bool
Determines whether a number is an integer power of 2.
$f(x) = (\exists n \in \Z : 2^n = x)$.
Worst-case complexity
Constant time and additional memory.
Examples
See here.