Skip to main content

ModPowerOf2AddMulAssign

Trait ModPowerOf2AddMulAssign 

Source
pub trait ModPowerOf2AddMulAssign<Y = Self, Z = Self> {
    // Required method
    fn mod_power_of_2_add_mul_assign(&mut self, y: Y, z: Z, pow: u64);
}
Expand description

Adds the product of two numbers to a number modulo $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

Required Methods§

Source

fn mod_power_of_2_add_mul_assign(&mut self, y: Y, z: Z, 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 ModPowerOf2AddMulAssign for u8

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: u8, z: u8, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Source§

impl ModPowerOf2AddMulAssign for u16

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: u16, z: u16, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Source§

impl ModPowerOf2AddMulAssign for u32

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: u32, z: u32, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Source§

impl ModPowerOf2AddMulAssign for u64

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: u64, z: u64, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Source§

impl ModPowerOf2AddMulAssign for u128

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: u128, z: u128, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Source§

impl ModPowerOf2AddMulAssign for usize

Source§

fn mod_power_of_2_add_mul_assign(&mut self, y: usize, z: usize, pow: u64)

Adds the product of two numbers to a third number, modulo a fourth number $2^k$, in place. All three inputs must be already reduced modulo $2^k$.

$x \gets w$, where $x, y, z, w < 2^k$ and $x + yz \equiv w \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§Panics

Panics if pow is greater than Self::WIDTH or if self, y, or z are greater than or equal to $2^k$.

§Examples

See here.

Implementors§