pub trait ModSubMul<Y = Self, Z = Self, M = Self> {
type Output;
// Required method
fn mod_sub_mul(self, y: Y, z: Z, m: M) -> Self::Output;
}Expand description
Subtracts the product of two numbers from a number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
Required Associated Types§
Required Methods§
fn mod_sub_mul(self, y: Y, z: Z, 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 ModSubMul for u8
impl ModSubMul for u8
Source§fn mod_sub_mul(self, y: u8, z: u8, m: u8) -> u8
fn mod_sub_mul(self, y: u8, z: u8, m: u8) -> u8
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u8
Source§impl ModSubMul for u16
impl ModSubMul for u16
Source§fn mod_sub_mul(self, y: u16, z: u16, m: u16) -> u16
fn mod_sub_mul(self, y: u16, z: u16, m: u16) -> u16
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u16
Source§impl ModSubMul for u32
impl ModSubMul for u32
Source§fn mod_sub_mul(self, y: u32, z: u32, m: u32) -> u32
fn mod_sub_mul(self, y: u32, z: u32, m: u32) -> u32
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u32
Source§impl ModSubMul for u64
impl ModSubMul for u64
Source§fn mod_sub_mul(self, y: u64, z: u64, m: u64) -> u64
fn mod_sub_mul(self, y: u64, z: u64, m: u64) -> u64
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u64
Source§impl ModSubMul for u128
impl ModSubMul for u128
Source§fn mod_sub_mul(self, y: u128, z: u128, m: u128) -> u128
fn mod_sub_mul(self, y: u128, z: u128, m: u128) -> u128
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.
type Output = u128
Source§impl ModSubMul for usize
impl ModSubMul for usize
Source§fn mod_sub_mul(self, y: usize, z: usize, m: usize) -> usize
fn mod_sub_mul(self, y: usize, z: usize, m: usize) -> usize
Subtracts the product of two numbers from a third number, modulo a fourth number $m$. All three inputs must be already reduced modulo $m$.
$f(x, y, z, m) = w$, where $x, y, z, w < m$ and $x - yz \equiv w \mod m$.
§Worst-case complexity
Constant time and additional memory.
§Panics
Panics if self, y, or z are greater than or equal to m.
§Examples
See here.