Skip to main content

ModAddMulShlAssign

Trait ModAddMulShlAssign 

Source
pub trait ModAddMulShlAssign<Y = Self, Z = Self, M = Self> {
    // Required method
    fn mod_add_mul_shl_assign(&mut self, y: Y, z: Z, bits: u64, m: M);
}
Expand description

Adds the product of two numbers, shifted left by a number of bits, to a number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

Required Methods§

Source

fn mod_add_mul_shl_assign(&mut self, y: Y, z: Z, bits: u64, m: M)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl ModAddMulShlAssign for u8

Source§

fn mod_add_mul_shl_assign(&mut self, y: u8, z: u8, bits: u64, m: u8)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Source§

impl ModAddMulShlAssign for u16

Source§

fn mod_add_mul_shl_assign(&mut self, y: u16, z: u16, bits: u64, m: u16)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Source§

impl ModAddMulShlAssign for u32

Source§

fn mod_add_mul_shl_assign(&mut self, y: u32, z: u32, bits: u64, m: u32)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Source§

impl ModAddMulShlAssign for u64

Source§

fn mod_add_mul_shl_assign(&mut self, y: u64, z: u64, bits: u64, m: u64)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Source§

impl ModAddMulShlAssign for u128

Source§

fn mod_add_mul_shl_assign(&mut self, y: u128, z: u128, bits: u64, m: u128)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Source§

impl ModAddMulShlAssign for usize

Source§

fn mod_add_mul_shl_assign(&mut self, y: usize, z: usize, bits: u64, m: usize)

Adds the product of two numbers, shifted left by bits, to a third number modulo a fourth number $m$, in place. All three inputs must be already reduced modulo $m$.

$x \gets 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.

Implementors§