Trait malachite_base::num::arithmetic::traits::ModPowerOf2Mul
source · [−]pub trait ModPowerOf2Mul<RHS = Self> {
type Output;
fn mod_power_of_2_mul(self, other: RHS, pow: u64) -> Self::Output;
}
Expand description
Multiplies two numbers modulo $2^k$. Assumes the inputs are already reduced modulo $2^k$.
Required Associated Types
Required Methods
fn mod_power_of_2_mul(self, other: RHS, pow: u64) -> Self::Output
Implementations on Foreign Types
sourceimpl ModPowerOf2Mul<u8> for u8
impl ModPowerOf2Mul<u8> for u8
sourcefn mod_power_of_2_mul(self, other: u8, pow: u64) -> u8
fn mod_power_of_2_mul(self, other: u8, pow: u64) -> u8
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.
type Output = u8
sourceimpl ModPowerOf2Mul<u16> for u16
impl ModPowerOf2Mul<u16> for u16
sourcefn mod_power_of_2_mul(self, other: u16, pow: u64) -> u16
fn mod_power_of_2_mul(self, other: u16, pow: u64) -> u16
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.
type Output = u16
sourceimpl ModPowerOf2Mul<u32> for u32
impl ModPowerOf2Mul<u32> for u32
sourcefn mod_power_of_2_mul(self, other: u32, pow: u64) -> u32
fn mod_power_of_2_mul(self, other: u32, pow: u64) -> u32
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.
type Output = u32
sourceimpl ModPowerOf2Mul<u64> for u64
impl ModPowerOf2Mul<u64> for u64
sourcefn mod_power_of_2_mul(self, other: u64, pow: u64) -> u64
fn mod_power_of_2_mul(self, other: u64, pow: u64) -> u64
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.
type Output = u64
sourceimpl ModPowerOf2Mul<u128> for u128
impl ModPowerOf2Mul<u128> for u128
sourcefn mod_power_of_2_mul(self, other: u128, pow: u64) -> u128
fn mod_power_of_2_mul(self, other: u128, pow: u64) -> u128
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.
type Output = u128
sourceimpl ModPowerOf2Mul<usize> for usize
impl ModPowerOf2Mul<usize> for usize
sourcefn mod_power_of_2_mul(self, other: usize, pow: u64) -> usize
fn mod_power_of_2_mul(self, other: usize, pow: u64) -> usize
Multiplies two numbers modulo a third number $2^k$. Assumes the inputs are already reduced modulo $2^k$.
$f(x, y, k) = z$, where $x, y, z < 2^k$ and $xy \equiv z \mod 2^k$.
Worst-case complexity
Constant time and additional memory.
Panics
Panics if pow
is greater than Self::WIDTH
.
Examples
See here.