pub struct PreMulInv2by1<T> { /* private fields */ }
Expand description

A wrapper of Normalized2by1Divisor that can be used as a Reducer

Implementations§

source§

impl PreMulInv2by1<u8>

source

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

source

pub const fn divisor(&self) -> u8

Get the normalized divisor.

source§

impl PreMulInv2by1<u16>

source

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

source

pub const fn divisor(&self) -> u16

Get the normalized divisor.

source§

impl PreMulInv2by1<u32>

source

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

source

pub const fn divisor(&self) -> u32

Get the normalized divisor.

source§

impl PreMulInv2by1<u64>

source

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

source

pub const fn divisor(&self) -> u64

Get the normalized divisor.

source§

impl PreMulInv2by1<usize>

source

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

source

pub const fn divisor(&self) -> usize

Get the normalized divisor.

source§

impl<T> PreMulInv2by1<T>

source

pub const fn divider(&self) -> &Normalized2by1Divisor<T>

source

pub const fn shift(&self) -> u32

Trait Implementations§

source§

impl<T: Clone> Clone for PreMulInv2by1<T>

source§

fn clone(&self) -> PreMulInv2by1<T>

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> Debug for PreMulInv2by1<T>

source§

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

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

impl<T: PartialEq> PartialEq<PreMulInv2by1<T>> for PreMulInv2by1<T>

source§

fn eq(&self, other: &PreMulInv2by1<T>) -> 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<u16> for PreMulInv2by1<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 PreMulInv2by1<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 PreMulInv2by1<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<u8> for PreMulInv2by1<u8>

source§

fn new(m: &u8) -> Self

Create a reducer for a modulus m
source§

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

Transform a normal integer into reduced form
source§

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

Check whether target is a valid reduced form
source§

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

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> u8

Get the modulus in original integer type
source§

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

Test if the residue() == 0
source§

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

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

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

Calculate 2*target mod m
source§

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

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

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

Calculate -monty mod m in reduced form
source§

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

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

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

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

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

Calculate target^2 mod m in reduced form
source§

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

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<usize> for PreMulInv2by1<usize>

source§

fn new(m: &usize) -> Self

Create a reducer for a modulus m
source§

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

Transform a normal integer into reduced form
source§

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

Check whether target is a valid reduced form
source§

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

Transform a reduced form back to normal integer
source§

fn modulus(&self) -> usize

Get the modulus in original integer type
source§

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

Test if the residue() == 0
source§

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

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

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

Calculate 2*target mod m
source§

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

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

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

Calculate -monty mod m in reduced form
source§

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.
source§

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

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

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

Calculate target^2 mod m in reduced form
source§

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

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> Copy for PreMulInv2by1<T>

source§

impl<T: Eq> Eq for PreMulInv2by1<T>

source§

impl<T> StructuralEq for PreMulInv2by1<T>

source§

impl<T> StructuralPartialEq for PreMulInv2by1<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for PreMulInv2by1<T>where T: RefUnwindSafe,

§

impl<T> Send for PreMulInv2by1<T>where T: Send,

§

impl<T> Sync for PreMulInv2by1<T>where T: Sync,

§

impl<T> Unpin for PreMulInv2by1<T>where T: Unpin,

§

impl<T> UnwindSafe for PreMulInv2by1<T>where 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.