Skip to content

Commit

Permalink
fix: reimplement monty optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
Autoparallel committed May 6, 2024
1 parent 6629016 commit 034ef34
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/field/gf_101.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ impl fmt::Display for GF101 {
}

impl GF101 {
// pub const fn new(value: u32) -> Self { Self { value: to_monty(value) } }
pub const fn new(value: u32) -> Self { Self { value: value % Self::ORDER } }
pub const fn new(value: u32) -> Self { Self { value: to_monty(value) } }
}

impl FiniteField for GF101 {
Expand Down Expand Up @@ -121,8 +120,7 @@ impl SubAssign for GF101 {
impl Mul for GF101 {
type Output = Self;

// fn mul(self, rhs: Self) -> Self { Self { value: from_monty(self.value * rhs.value) } }
fn mul(self, rhs: Self) -> Self { Self { value: (self.value * rhs.value) % Self::ORDER } }
fn mul(self, rhs: Self) -> Self { Self { value: from_monty(self.value * rhs.value) } }
}

impl MulAssign for GF101 {
Expand Down

0 comments on commit 034ef34

Please sign in to comment.