num_modular

Trait ModularCoreOps

Source
pub trait ModularCoreOps<Rhs = Self, Modulus = Self> {
    type Output;

    // Required methods
    fn addm(self, rhs: Rhs, m: Modulus) -> Self::Output;
    fn subm(self, rhs: Rhs, m: Modulus) -> Self::Output;
    fn mulm(self, rhs: Rhs, m: Modulus) -> Self::Output;
}
Expand description

Core modular arithmetic operations.

Note that all functions will panic if the modulus is zero.

Required Associated Types§

Required Methods§

Source

fn addm(self, rhs: Rhs, m: Modulus) -> Self::Output

Return (self + rhs) % m

Source

fn subm(self, rhs: Rhs, m: Modulus) -> Self::Output

Return (self - rhs) % m

Source

fn mulm(self, rhs: Rhs, m: Modulus) -> Self::Output

Return (self * rhs) % m

Implementations on Foreign Types§

Source§

impl ModularCoreOps<&u8, &u8> for &u8

Source§

type Output = u8

Source§

fn addm(self, rhs: &u8, m: &u8) -> u8

Source§

fn subm(self, rhs: &u8, m: &u8) -> u8

Source§

fn mulm(self, rhs: &u8, m: &u8) -> u8

Source§

impl ModularCoreOps<&u8, &u8> for u8

Source§

type Output = u8

Source§

fn addm(self, rhs: &u8, m: &u8) -> u8

Source§

fn subm(self, rhs: &u8, m: &u8) -> u8

Source§

fn mulm(self, rhs: &u8, m: &u8) -> u8

Source§

impl ModularCoreOps<&u16, &u16> for &u16

Source§

type Output = u16

Source§

fn addm(self, rhs: &u16, m: &u16) -> u16

Source§

fn subm(self, rhs: &u16, m: &u16) -> u16

Source§

fn mulm(self, rhs: &u16, m: &u16) -> u16

Source§

impl ModularCoreOps<&u16, &u16> for u16

Source§

type Output = u16

Source§

fn addm(self, rhs: &u16, m: &u16) -> u16

Source§

fn subm(self, rhs: &u16, m: &u16) -> u16

Source§

fn mulm(self, rhs: &u16, m: &u16) -> u16

Source§

impl ModularCoreOps<&u32, &u32> for &u32

Source§

type Output = u32

Source§

fn addm(self, rhs: &u32, m: &u32) -> u32

Source§

fn subm(self, rhs: &u32, m: &u32) -> u32

Source§

fn mulm(self, rhs: &u32, m: &u32) -> u32

Source§

impl ModularCoreOps<&u32, &u32> for u32

Source§

type Output = u32

Source§

fn addm(self, rhs: &u32, m: &u32) -> u32

Source§

fn subm(self, rhs: &u32, m: &u32) -> u32

Source§

fn mulm(self, rhs: &u32, m: &u32) -> u32

Source§

impl ModularCoreOps<&u64, &u64> for &u64

Source§

type Output = u64

Source§

fn addm(self, rhs: &u64, m: &u64) -> u64

Source§

fn subm(self, rhs: &u64, m: &u64) -> u64

Source§

fn mulm(self, rhs: &u64, m: &u64) -> u64

Source§

impl ModularCoreOps<&u64, &u64> for u64

Source§

type Output = u64

Source§

fn addm(self, rhs: &u64, m: &u64) -> u64

Source§

fn subm(self, rhs: &u64, m: &u64) -> u64

Source§

fn mulm(self, rhs: &u64, m: &u64) -> u64

Source§

impl ModularCoreOps<&u128, &u128> for &u128

Source§

type Output = u128

Source§

fn addm(self, rhs: &u128, m: &u128) -> u128

Source§

fn subm(self, rhs: &u128, m: &u128) -> u128

Source§

fn mulm(self, rhs: &u128, m: &u128) -> u128

Source§

impl ModularCoreOps<&u128, &u128> for u128

Source§

type Output = u128

Source§

fn addm(self, rhs: &u128, m: &u128) -> u128

Source§

fn subm(self, rhs: &u128, m: &u128) -> u128

Source§

fn mulm(self, rhs: &u128, m: &u128) -> u128

Source§

impl ModularCoreOps<&usize, &usize> for &usize

Source§

type Output = usize

Source§

fn addm(self, rhs: &usize, m: &usize) -> usize

Source§

fn subm(self, rhs: &usize, m: &usize) -> usize

Source§

fn mulm(self, rhs: &usize, m: &usize) -> usize

Source§

impl ModularCoreOps<&usize, &usize> for usize

Source§

type Output = usize

Source§

fn addm(self, rhs: &usize, m: &usize) -> usize

Source§

fn subm(self, rhs: &usize, m: &usize) -> usize

Source§

fn mulm(self, rhs: &usize, m: &usize) -> usize

Source§

impl ModularCoreOps<&BigUint, &BigUint> for &BigUint

Source§

type Output = BigUint

Source§

fn addm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

fn subm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

fn mulm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

impl ModularCoreOps<&BigUint, &BigUint> for BigUint

Source§

type Output = BigUint

Source§

fn addm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

fn subm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

fn mulm(self, rhs: &BigUint, m: &BigUint) -> BigUint

Source§

impl ModularCoreOps<u8, &u8> for &u8

Source§

type Output = u8

Source§

fn addm(self, rhs: u8, m: &u8) -> u8

Source§

fn subm(self, rhs: u8, m: &u8) -> u8

Source§

fn mulm(self, rhs: u8, m: &u8) -> u8

Source§

impl ModularCoreOps<u8, &u8> for u8

Source§

type Output = u8

Source§

fn addm(self, rhs: u8, m: &u8) -> u8

Source§

fn subm(self, rhs: u8, m: &u8) -> u8

Source§

fn mulm(self, rhs: u8, m: &u8) -> u8

Source§

impl ModularCoreOps<u16, &u16> for &u16

Source§

type Output = u16

Source§

fn addm(self, rhs: u16, m: &u16) -> u16

Source§

fn subm(self, rhs: u16, m: &u16) -> u16

Source§

fn mulm(self, rhs: u16, m: &u16) -> u16

Source§

impl ModularCoreOps<u16, &u16> for u16

Source§

type Output = u16

Source§

fn addm(self, rhs: u16, m: &u16) -> u16

Source§

fn subm(self, rhs: u16, m: &u16) -> u16

Source§

fn mulm(self, rhs: u16, m: &u16) -> u16

Source§

impl ModularCoreOps<u32, &u32> for &u32

Source§

type Output = u32

Source§

fn addm(self, rhs: u32, m: &u32) -> u32

Source§

fn subm(self, rhs: u32, m: &u32) -> u32

Source§

fn mulm(self, rhs: u32, m: &u32) -> u32

Source§

impl ModularCoreOps<u32, &u32> for u32

Source§

type Output = u32

Source§

fn addm(self, rhs: u32, m: &u32) -> u32

Source§

fn subm(self, rhs: u32, m: &u32) -> u32

Source§

fn mulm(self, rhs: u32, m: &u32) -> u32

Source§

impl ModularCoreOps<u64, &u64> for &u64

Source§

type Output = u64

Source§

fn addm(self, rhs: u64, m: &u64) -> u64

Source§

fn subm(self, rhs: u64, m: &u64) -> u64

Source§

fn mulm(self, rhs: u64, m: &u64) -> u64

Source§

impl ModularCoreOps<u64, &u64> for u64

Source§

type Output = u64

Source§

fn addm(self, rhs: u64, m: &u64) -> u64

Source§

fn subm(self, rhs: u64, m: &u64) -> u64

Source§

fn mulm(self, rhs: u64, m: &u64) -> u64

Source§

impl ModularCoreOps<u128, &u128> for &u128

Source§

type Output = u128

Source§

fn addm(self, rhs: u128, m: &u128) -> u128

Source§

fn subm(self, rhs: u128, m: &u128) -> u128

Source§

fn mulm(self, rhs: u128, m: &u128) -> u128

Source§

impl ModularCoreOps<u128, &u128> for u128

Source§

type Output = u128

Source§

fn addm(self, rhs: u128, m: &u128) -> u128

Source§

fn subm(self, rhs: u128, m: &u128) -> u128

Source§

fn mulm(self, rhs: u128, m: &u128) -> u128

Source§

impl ModularCoreOps<usize, &usize> for &usize

Source§

type Output = usize

Source§

fn addm(self, rhs: usize, m: &usize) -> usize

Source§

fn subm(self, rhs: usize, m: &usize) -> usize

Source§

fn mulm(self, rhs: usize, m: &usize) -> usize

Source§

impl ModularCoreOps<usize, &usize> for usize

Source§

type Output = usize

Source§

fn addm(self, rhs: usize, m: &usize) -> usize

Source§

fn subm(self, rhs: usize, m: &usize) -> usize

Source§

fn mulm(self, rhs: usize, m: &usize) -> usize

Source§

impl ModularCoreOps<BigUint, &BigUint> for &BigUint

Source§

type Output = BigUint

Source§

fn addm(self, rhs: BigUint, m: &BigUint) -> BigUint

Source§

fn subm(self, rhs: BigUint, m: &BigUint) -> BigUint

Source§

fn mulm(self, rhs: BigUint, m: &BigUint) -> BigUint

Source§

impl ModularCoreOps<BigUint, &BigUint> for BigUint

Source§

type Output = BigUint

Source§

fn addm(self, rhs: BigUint, m: &BigUint) -> BigUint

Source§

fn subm(self, rhs: BigUint, m: &BigUint) -> BigUint

Source§

fn mulm(self, rhs: BigUint, m: &BigUint) -> BigUint

Implementors§