pub struct Vanilla<T>(/* private fields */);Expand description
A plain reducer that just use normal Rem operators. It will keep the integer in range [0, modulus) after each operation.
Trait Implementations§
impl<T: Copy> Copy for Vanilla<T>
Source§impl Reducer<BigUint> for Vanilla<BigUint>
impl Reducer<BigUint> for Vanilla<BigUint>
Source§fn add(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
fn add(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
Calculate (lhs + rhs) mod m in reduced form
Source§fn sub(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
fn sub(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
Calculate (lhs - rhs) mod m in reduced form
Source§fn mul(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
fn mul(&self, lhs: &BigUint, rhs: &BigUint) -> BigUint
Calculate (lhs * rhs) mod m in reduced form
Source§fn inv(&self, target: BigUint) -> Option<BigUint>
fn inv(&self, target: BigUint) -> Option<BigUint>
Calculate target^-1 mod m in reduced form,
it may return None when there is no modular inverse.
Source§fn pow(&self, base: BigUint, exp: &BigUint) -> BigUint
fn pow(&self, base: BigUint, exp: &BigUint) -> BigUint
Calculate base ^ exp mod m in reduced form
fn add_in_place(&self, lhs: &mut T, rhs: &T)
fn sub_in_place(&self, lhs: &mut T, rhs: &T)
fn mul_in_place(&self, lhs: &mut T, rhs: &T)
Source§impl Reducer<u8> for Vanilla<u8>
impl Reducer<u8> for Vanilla<u8>
Source§impl Reducer<u16> for Vanilla<u16>
impl Reducer<u16> for Vanilla<u16>
Source§impl Reducer<u32> for Vanilla<u32>
impl Reducer<u32> for Vanilla<u32>
Source§impl Reducer<u64> for Vanilla<u64>
impl Reducer<u64> for Vanilla<u64>
Source§impl Reducer<u128> for Vanilla<u128>
impl Reducer<u128> for Vanilla<u128>
Source§impl Reducer<usize> for Vanilla<usize>
impl Reducer<usize> for Vanilla<usize>
Source§fn inv(&self, target: usize) -> Option<usize>
fn inv(&self, target: usize) -> Option<usize>
Calculate target^-1 mod m in reduced form,
it may return None when there is no modular inverse.
fn add_in_place(&self, lhs: &mut T, rhs: &T)
fn sub_in_place(&self, lhs: &mut T, rhs: &T)
fn mul_in_place(&self, lhs: &mut T, rhs: &T)
Auto Trait Implementations§
impl<T> Freeze for Vanilla<T>where
T: Freeze,
impl<T> RefUnwindSafe for Vanilla<T>where
T: RefUnwindSafe,
impl<T> Send for Vanilla<T>where
T: Send,
impl<T> Sync for Vanilla<T>where
T: Sync,
impl<T> Unpin for Vanilla<T>where
T: Unpin,
impl<T> UnsafeUnpin for Vanilla<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Vanilla<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more