Trait EqModPowerOf2

Source
pub trait EqModPowerOf2<RHS = Self> {
    // Required method
    fn eq_mod_power_of_2(self, other: RHS, pow: u64) -> bool;
}
Expand description

Determines whether a number is equivalent to another number modulo $2^k$.

Required Methods§

Source

fn eq_mod_power_of_2(self, other: RHS, pow: u64) -> bool

Implementations on Foreign Types§

Source§

impl EqModPowerOf2 for i8

Source§

fn eq_mod_power_of_2(self, other: i8, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for i16

Source§

fn eq_mod_power_of_2(self, other: i16, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for i32

Source§

fn eq_mod_power_of_2(self, other: i32, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for i64

Source§

fn eq_mod_power_of_2(self, other: i64, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for i128

Source§

fn eq_mod_power_of_2(self, other: i128, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for isize

Source§

fn eq_mod_power_of_2(self, other: isize, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for u8

Source§

fn eq_mod_power_of_2(self, other: u8, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for u16

Source§

fn eq_mod_power_of_2(self, other: u16, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for u32

Source§

fn eq_mod_power_of_2(self, other: u32, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for u64

Source§

fn eq_mod_power_of_2(self, other: u64, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for u128

Source§

fn eq_mod_power_of_2(self, other: u128, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Source§

impl EqModPowerOf2 for usize

Source§

fn eq_mod_power_of_2(self, other: usize, pow: u64) -> bool

Returns whether one number is equal to another modulo $2^k$.

$f(x, y, k) = (x \equiv y \mod 2^k)$.

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

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§