Skip to main content

ModPowerOf2IsReduced

Trait ModPowerOf2IsReduced 

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

Checks whether a number is reduced modulo $2^k$.

Required Methods§

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ModPowerOf2IsReduced for u8

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl ModPowerOf2IsReduced for u16

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl ModPowerOf2IsReduced for u32

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl ModPowerOf2IsReduced for u64

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl ModPowerOf2IsReduced for u128

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl ModPowerOf2IsReduced for usize

Source§

fn mod_power_of_2_is_reduced(&self, pow: u64) -> bool

Returns whether a number is reduced modulo another number $2^k$; in other words, whether it has no more than $k$ significant bits.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§