Trait DivisibleByPowerOf2

Source
pub trait DivisibleByPowerOf2 {
    // Required method
    fn divisible_by_power_of_2(self, pow: u64) -> bool;
}
Expand description

Determines whether a number is divisible by $2^k$.

Required Methods§

Implementations on Foreign Types§

Source§

impl DivisibleByPowerOf2 for i8

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for i16

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for i32

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for i64

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for i128

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for isize

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for u8

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for u16

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for u32

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for u64

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for u128

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl DivisibleByPowerOf2 for usize

Source§

fn divisible_by_power_of_2(self, pow: u64) -> bool

Returns whether a number is divisible by $2^k$.

$f(x, k) = (2^k|x)$.

$f(x, k) = (\exists n \in \N : \ x = n2^k)$.

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§