mirror of
https://github.com/arnaucube/poulpy.git
synced 2026-02-10 13:16:44 +01:00
Added base for Montgomery arithmetic
This commit is contained in:
19
src/modulus/barrett.rs
Normal file
19
src/modulus/barrett.rs
Normal file
@@ -0,0 +1,19 @@
|
||||
pub struct BarrettPrecomp<O>(O, O);
|
||||
|
||||
impl<O> BarrettPrecomp<O>{
|
||||
|
||||
#[inline(always)]
|
||||
pub fn new(a:O, b: O) -> Self{
|
||||
Self(a, b)
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn value_hi(&self) -> &O{
|
||||
&self.0
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn value_lo(&self) -> &O{
|
||||
&self.1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user