pub trait ModAddMulShl<Y = Self, Z = Self, M = Self> {
type Output;
// Required method
fn mod_add_mul_shl(self, y: Y, z: Z, bits: u64, m: M) -> Self::Output;
}Expand description
Adds a number and the product of two other numbers, shifted left by a number of bits, modulo a fourth number $m$: $x + yz2^b \bmod m$. All three inputs must be already reduced modulo $m$.
Required Associated Types§
Required Methods§
fn mod_add_mul_shl(self, y: Y, z: Z, bits: u64, m: M) -> Self::Output
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ModAddMulShl for u8
impl ModAddMulShl for u8
Source§fn mod_add_mul_shl(self, y: u8, z: u8, bits: u64, m: u8) -> u8
fn mod_add_mul_shl(self, y: u8, z: u8, bits: u64, m: u8) -> u8
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u8
Source§impl ModAddMulShl for u16
impl ModAddMulShl for u16
Source§fn mod_add_mul_shl(self, y: u16, z: u16, bits: u64, m: u16) -> u16
fn mod_add_mul_shl(self, y: u16, z: u16, bits: u64, m: u16) -> u16
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u16
Source§impl ModAddMulShl for u32
impl ModAddMulShl for u32
Source§fn mod_add_mul_shl(self, y: u32, z: u32, bits: u64, m: u32) -> u32
fn mod_add_mul_shl(self, y: u32, z: u32, bits: u64, m: u32) -> u32
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u32
Source§impl ModAddMulShl for u64
impl ModAddMulShl for u64
Source§fn mod_add_mul_shl(self, y: u64, z: u64, bits: u64, m: u64) -> u64
fn mod_add_mul_shl(self, y: u64, z: u64, bits: u64, m: u64) -> u64
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u64
Source§impl ModAddMulShl for u128
impl ModAddMulShl for u128
Source§fn mod_add_mul_shl(self, y: u128, z: u128, bits: u64, m: u128) -> u128
fn mod_add_mul_shl(self, y: u128, z: u128, bits: u64, m: u128) -> u128
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u128
Source§impl ModAddMulShl for usize
impl ModAddMulShl for usize
Source§fn mod_add_mul_shl(self, y: usize, z: usize, bits: u64, m: usize) -> usize
fn mod_add_mul_shl(self, y: usize, z: usize, bits: u64, m: usize) -> usize
Adds a number and the product of two other numbers, shifted left by bits, modulo a
fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, b, m) = w$, where $x, y, z, w < m$ and $x + yz2^b \equiv w \mod m$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is bits.significant_bits().
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.