pub trait ModPowerOf2Add<RHS = Self> {
type Output;

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

Adds two numbers modulo $2^k$. The inputs must be already reduced modulo $2^k$.

source

source

## Implementations on Foreign Types§

source§

source§

#### fn mod_power_of_2_add(self, other: u8, pow: u64) -> u8

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§

source§

source§

#### fn mod_power_of_2_add(self, other: u16, pow: u64) -> u16

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§

source§

source§

#### fn mod_power_of_2_add(self, other: u32, pow: u64) -> u32

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§

source§

source§

#### fn mod_power_of_2_add(self, other: u64, pow: u64) -> u64

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§

source§

source§

#### fn mod_power_of_2_add(self, other: u128, pow: u64) -> u128

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§

source§

source§

#### fn mod_power_of_2_add(self, other: usize, pow: u64) -> usize

Adds two numbers modulo a third number $2^k$. The inputs must be already reduced modulo $2^k$.

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

##### §Panics

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

See here.

§