Trait ModPowerOf2Neg

Source
pub trait ModPowerOf2Neg {
    type Output;

    // Required method
    fn mod_power_of_2_neg(self, pow: u64) -> Self::Output;
}
Expand description

Negates a number modulo $2^k$. The input must be already reduced modulo $2^k$.

Required Associated Types§

Required Methods§

Source

fn mod_power_of_2_neg(self, pow: u64) -> Self::Output

Implementations on Foreign Types§

Source§

impl ModPowerOf2Neg for u8

Source§

fn mod_power_of_2_neg(self, pow: u64) -> u8

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = u8

Source§

impl ModPowerOf2Neg for u16

Source§

fn mod_power_of_2_neg(self, pow: u64) -> u16

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = u16

Source§

impl ModPowerOf2Neg for u32

Source§

fn mod_power_of_2_neg(self, pow: u64) -> u32

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = u32

Source§

impl ModPowerOf2Neg for u64

Source§

fn mod_power_of_2_neg(self, pow: u64) -> u64

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = u64

Source§

impl ModPowerOf2Neg for u128

Source§

fn mod_power_of_2_neg(self, pow: u64) -> u128

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = u128

Source§

impl ModPowerOf2Neg for usize

Source§

fn mod_power_of_2_neg(self, pow: u64) -> usize

Negates a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $-x \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self is greater than or equal to $2^k$.

§Examples

See here.

Source§

type Output = usize

Implementors§