Added base for Montgomery arithmetic

This commit is contained in:
Jean-Philippe Bossuat
2024-12-04 12:53:13 +01:00
parent a957701614
commit ee96c2f904
9 changed files with 353 additions and 0 deletions

19
src/modulus/barrett.rs Normal file
View 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
}
}