pub struct PreMulInv3by2<T, D> { /* private fields */ }
Expand description

A wrapper of Normalized3by2Divisor that can be used as a Reducer

Implementations§

source§

impl PreMulInv3by2<u8, u16>

source

pub const fn new(divisor: u16) -> Self

source

pub const fn divisor(&self) -> u16

Get the normalized divisor.

source§

impl PreMulInv3by2<u16, u32>

source

pub const fn new(divisor: u32) -> Self

source

pub const fn divisor(&self) -> u32

Get the normalized divisor.

source§

impl PreMulInv3by2<u32, u64>

source

pub const fn new(divisor: u64) -> Self

source

pub const fn divisor(&self) -> u64

Get the normalized divisor.

source§

impl PreMulInv3by2<u64, u128>

source

pub const fn new(divisor: u128) -> Self

source

pub const fn divisor(&self) -> u128

Get the normalized divisor.

source§

impl PreMulInv3by2<usize, u64>

source

pub const fn new(divisor: u64) -> Self

source

pub const fn divisor(&self) -> u64

Get the normalized divisor.

source§

impl<T, D> PreMulInv3by2<T, D>

source

pub const fn divider(&self) -> &Normalized3by2Divisor<T, D>

source

pub const fn shift(&self) -> u32

Trait Implementations§

source§

impl<T: Clone, D: Clone> Clone for PreMulInv3by2<T, D>

source§

fn clone(&self) -> PreMulInv3by2<T, D>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: Debug, D: Debug> Debug for PreMulInv3by2<T, D>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T: PartialEq, D: PartialEq> PartialEq<PreMulInv3by2<T, D>> for PreMulInv3by2<T, D>

source§

fn eq(&self, other: &PreMulInv3by2<T, D>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Reducer<u128> for PreMulInv3by2<u64, u128>

source§

fn new(m: &u128) -> Self

Create a reducer for a modulus m
source§

fn transform(&self, target: u128) -> u128

Transform a normal integer into reduced form
source§

fn check(&self, target: &u128) -> bool

Check whether target is a valid reduced form
source§

fn residue(&self, target: u128) -> u128

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u128

Get the modulus in original integer type
source§

fn is_zero(&self, target: &u128) -> bool

Test if the residue() == 0
source§

fn add(&self, lhs: &u128, rhs: &u128) -> u128

Calculate (lhs + rhs) mod m in reduced form
source§

fn dbl(&self, target: u128) -> u128

Calculate 2*target mod m
source§

fn sub(&self, lhs: &u128, rhs: &u128) -> u128

Calculate (lhs - rhs) mod m in reduced form
source§

fn neg(&self, target: u128) -> u128

Calculate -monty mod m in reduced form
source§

fn inv(&self, target: u128) -> Option<u128>

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse.
source§

fn mul(&self, lhs: &u128, rhs: &u128) -> u128

Calculate (lhs * rhs) mod m in reduced form
source§

fn sqr(&self, target: u128) -> u128

Calculate target^2 mod m in reduced form
source§

fn pow(&self, base: u128, exp: &u128) -> u128

Calculate base ^ exp mod m in reduced form
source§

fn add_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn sub_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn mul_in_place(&self, lhs: &mut T, rhs: &T)

source§

impl Reducer<u16> for PreMulInv3by2<u8, u16>

source§

fn new(m: &u16) -> Self

Create a reducer for a modulus m
source§

fn transform(&self, target: u16) -> u16

Transform a normal integer into reduced form
source§

fn check(&self, target: &u16) -> bool

Check whether target is a valid reduced form
source§

fn residue(&self, target: u16) -> u16

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u16

Get the modulus in original integer type
source§

fn is_zero(&self, target: &u16) -> bool

Test if the residue() == 0
source§

fn add(&self, lhs: &u16, rhs: &u16) -> u16

Calculate (lhs + rhs) mod m in reduced form
source§

fn dbl(&self, target: u16) -> u16

Calculate 2*target mod m
source§

fn sub(&self, lhs: &u16, rhs: &u16) -> u16

Calculate (lhs - rhs) mod m in reduced form
source§

fn neg(&self, target: u16) -> u16

Calculate -monty mod m in reduced form
source§

fn inv(&self, target: u16) -> Option<u16>

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse.
source§

fn mul(&self, lhs: &u16, rhs: &u16) -> u16

Calculate (lhs * rhs) mod m in reduced form
source§

fn sqr(&self, target: u16) -> u16

Calculate target^2 mod m in reduced form
source§

fn pow(&self, base: u16, exp: &u16) -> u16

Calculate base ^ exp mod m in reduced form
source§

fn add_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn sub_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn mul_in_place(&self, lhs: &mut T, rhs: &T)

source§

impl Reducer<u32> for PreMulInv3by2<u16, u32>

source§

fn new(m: &u32) -> Self

Create a reducer for a modulus m
source§

fn transform(&self, target: u32) -> u32

Transform a normal integer into reduced form
source§

fn check(&self, target: &u32) -> bool

Check whether target is a valid reduced form
source§

fn residue(&self, target: u32) -> u32

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u32

Get the modulus in original integer type
source§

fn is_zero(&self, target: &u32) -> bool

Test if the residue() == 0
source§

fn add(&self, lhs: &u32, rhs: &u32) -> u32

Calculate (lhs + rhs) mod m in reduced form
source§

fn dbl(&self, target: u32) -> u32

Calculate 2*target mod m
source§

fn sub(&self, lhs: &u32, rhs: &u32) -> u32

Calculate (lhs - rhs) mod m in reduced form
source§

fn neg(&self, target: u32) -> u32

Calculate -monty mod m in reduced form
source§

fn inv(&self, target: u32) -> Option<u32>

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse.
source§

fn mul(&self, lhs: &u32, rhs: &u32) -> u32

Calculate (lhs * rhs) mod m in reduced form
source§

fn sqr(&self, target: u32) -> u32

Calculate target^2 mod m in reduced form
source§

fn pow(&self, base: u32, exp: &u32) -> u32

Calculate base ^ exp mod m in reduced form
source§

fn add_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn sub_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn mul_in_place(&self, lhs: &mut T, rhs: &T)

source§

impl Reducer<u64> for PreMulInv3by2<u32, u64>

source§

fn new(m: &u64) -> Self

Create a reducer for a modulus m
source§

fn transform(&self, target: u64) -> u64

Transform a normal integer into reduced form
source§

fn check(&self, target: &u64) -> bool

Check whether target is a valid reduced form
source§

fn residue(&self, target: u64) -> u64

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u64

Get the modulus in original integer type
source§

fn is_zero(&self, target: &u64) -> bool

Test if the residue() == 0
source§

fn add(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs + rhs) mod m in reduced form
source§

fn dbl(&self, target: u64) -> u64

Calculate 2*target mod m
source§

fn sub(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs - rhs) mod m in reduced form
source§

fn neg(&self, target: u64) -> u64

Calculate -monty mod m in reduced form
source§

fn inv(&self, target: u64) -> Option<u64>

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse.
source§

fn mul(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs * rhs) mod m in reduced form
source§

fn sqr(&self, target: u64) -> u64

Calculate target^2 mod m in reduced form
source§

fn pow(&self, base: u64, exp: &u64) -> u64

Calculate base ^ exp mod m in reduced form
source§

fn add_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn sub_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn mul_in_place(&self, lhs: &mut T, rhs: &T)

source§

impl Reducer<u64> for PreMulInv3by2<usize, u64>

source§

fn new(m: &u64) -> Self

Create a reducer for a modulus m
source§

fn transform(&self, target: u64) -> u64

Transform a normal integer into reduced form
source§

fn check(&self, target: &u64) -> bool

Check whether target is a valid reduced form
source§

fn residue(&self, target: u64) -> u64

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u64

Get the modulus in original integer type
source§

fn is_zero(&self, target: &u64) -> bool

Test if the residue() == 0
source§

fn add(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs + rhs) mod m in reduced form
source§

fn dbl(&self, target: u64) -> u64

Calculate 2*target mod m
source§

fn sub(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs - rhs) mod m in reduced form
source§

fn neg(&self, target: u64) -> u64

Calculate -monty mod m in reduced form
source§

fn inv(&self, target: u64) -> Option<u64>

Calculate target^-1 mod m in reduced form, it may return None when there is no modular inverse.
source§

fn mul(&self, lhs: &u64, rhs: &u64) -> u64

Calculate (lhs * rhs) mod m in reduced form
source§

fn sqr(&self, target: u64) -> u64

Calculate target^2 mod m in reduced form
source§

fn pow(&self, base: u64, exp: &u64) -> u64

Calculate base ^ exp mod m in reduced form
source§

fn add_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn sub_in_place(&self, lhs: &mut T, rhs: &T)

source§

fn mul_in_place(&self, lhs: &mut T, rhs: &T)

source§

impl<T: Copy, D: Copy> Copy for PreMulInv3by2<T, D>

source§

impl<T: Eq, D: Eq> Eq for PreMulInv3by2<T, D>

source§

impl<T, D> StructuralEq for PreMulInv3by2<T, D>

source§

impl<T, D> StructuralPartialEq for PreMulInv3by2<T, D>

Auto Trait Implementations§

§

impl<T, D> RefUnwindSafe for PreMulInv3by2<T, D>where D: RefUnwindSafe, T: RefUnwindSafe,

§

impl<T, D> Send for PreMulInv3by2<T, D>where D: Send, T: Send,

§

impl<T, D> Sync for PreMulInv3by2<T, D>where D: Sync, T: Sync,

§

impl<T, D> Unpin for PreMulInv3by2<T, D>where D: Unpin, T: Unpin,

§

impl<T, D> UnwindSafe for PreMulInv3by2<T, D>where D: UnwindSafe, T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.