pub trait ModPowerOf2AddAssign<RHS = Self> {
// Required method
fn mod_power_of_2_add_assign(&mut self, other: RHS, pow: u64);
}Expand description
Adds two numbers modulo $2^k$, in place. The inputs must be already reduced modulo $2^k$.
Required Methods§
fn mod_power_of_2_add_assign(&mut self, other: RHS, pow: u64)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ModPowerOf2AddAssign for u8
impl ModPowerOf2AddAssign for u8
Source§fn mod_power_of_2_add_assign(&mut self, other: u8, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: u8, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.
Source§impl ModPowerOf2AddAssign for u16
impl ModPowerOf2AddAssign for u16
Source§fn mod_power_of_2_add_assign(&mut self, other: u16, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: u16, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.
Source§impl ModPowerOf2AddAssign for u32
impl ModPowerOf2AddAssign for u32
Source§fn mod_power_of_2_add_assign(&mut self, other: u32, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: u32, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.
Source§impl ModPowerOf2AddAssign for u64
impl ModPowerOf2AddAssign for u64
Source§fn mod_power_of_2_add_assign(&mut self, other: u64, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: u64, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.
Source§impl ModPowerOf2AddAssign for u128
impl ModPowerOf2AddAssign for u128
Source§fn mod_power_of_2_add_assign(&mut self, other: u128, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: u128, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.
Source§impl ModPowerOf2AddAssign for usize
impl ModPowerOf2AddAssign for usize
Source§fn mod_power_of_2_add_assign(&mut self, other: usize, pow: u64)
fn mod_power_of_2_add_assign(&mut self, other: usize, pow: u64)
Adds two numbers modulo a third number $2^k$, in place. The inputs must be already reduced modulo $2^k$.
$x \gets z$, where $x, y, z < 2^k$ and $x + y \equiv z \mod 2^k$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if pow is greater than Self::WIDTH or if self or other are greater
than or equal to $2^k$.
§Examples
See here.