Skip to main content

ModSubMul

Trait ModSubMul 

Source
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§

Source

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

Source§

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.

Source§

type Output = u8

Source§

impl ModSubMul for u16

Source§

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.

Source§

type Output = u16

Source§

impl ModSubMul for u32

Source§

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.

Source§

type Output = u32

Source§

impl ModSubMul for u64

Source§

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.

Source§

type Output = u64

Source§

impl ModSubMul for u128

Source§

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.

Source§

type Output = u128

Source§

impl ModSubMul for usize

Source§

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.

Source§

type Output = usize

Implementors§