pub struct FixedProth64<const N: u8, const K: u8>;Expand description
A modular reducer for Proth primes K * 2^N + 1 with 64-bit operands.
Supports N up to 63, K odd with K < 2^N. Montgomery form with R = 2⁶⁴.
§Example
use num_modular::{FixedProth64, Reducer};
const N: u8 = 5;
const K: u8 = 3;
let modulus = (K as u64) * (1u64 << N) + 1; // 3*2^5 + 1 = 97
let reducer = FixedProth64::<N, K>::new(&modulus);
let a = reducer.transform(10);
let b = reducer.transform(20);
assert_eq!(reducer.residue(reducer.mul(&a, &b)), (10u64 * 20) % 97);Implementations§
Trait Implementations§
Source§impl<const N: u8, const K: u8> Clone for FixedProth64<N, K>
impl<const N: u8, const K: u8> Clone for FixedProth64<N, K>
Source§fn clone(&self) -> FixedProth64<N, K>
fn clone(&self) -> FixedProth64<N, K>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<const N: u8, const K: u8> Copy for FixedProth64<N, K>
Source§impl<const N: u8, const K: u8> Reducer<u64> for FixedProth64<N, K>
impl<const N: u8, const K: u8> Reducer<u64> for FixedProth64<N, K>
Auto Trait Implementations§
impl<const N: u8, const K: u8> Freeze for FixedProth64<N, K>
impl<const N: u8, const K: u8> RefUnwindSafe for FixedProth64<N, K>
impl<const N: u8, const K: u8> Send for FixedProth64<N, K>
impl<const N: u8, const K: u8> Sync for FixedProth64<N, K>
impl<const N: u8, const K: u8> Unpin for FixedProth64<N, K>
impl<const N: u8, const K: u8> UnsafeUnpin for FixedProth64<N, K>
impl<const N: u8, const K: u8> UnwindSafe for FixedProth64<N, K>
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