pub trait IsPowerOf2 {
    fn is_power_of_2(&self) -> bool;
}
Expand description

Determines whether a number is an integer power of 2.

Required Methods

Implementations on Foreign Types

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

This is a wrapper over the is_power_of_two functions in the standard library, for example this one.

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.

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.

Implementors