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<&u16, &u16> for u16

§

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<&u128, &u128> for &u128

§

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<&u16, &u16> for &u16

§

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<&u128, &u128> for u128

§

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<u8, &u8> for u8

§

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<u32, &u32> for &u32

§

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<&u8, &u8> for &u8

§

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<u128, &u128> for u128

§

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<u64, &u64> for &u64

§

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

§

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

§

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

§

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<&u32, &u32> for u32

§

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

§

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<&usize, &usize> for usize

§

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<u8, &u8> for &u8

§

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

§

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<&BigUint, &BigUint> for BigUint

§

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

§

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<u16, &u16> for u16

§

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<&u8, &u8> for u8

§

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<BigUint, &BigUint> for &BigUint

§

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<&usize, &usize> for &usize

§

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

§

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<u64, &u64> for u64

§

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<usize, &usize> for usize

§

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

§

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<u32, &u32> for u32

§

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

Implementors§