diff --git a/src/bn256/fr.rs b/src/bn256/fr.rs index ac90d403..821c37d0 100644 --- a/src/bn256/fr.rs +++ b/src/bn256/fr.rs @@ -325,9 +325,8 @@ impl<'a> MulAddAssign<&'a Fr, Fr> for Fr { impl<'a, 'b> MulAddAssign<&'a Fr, &'b Fr> for Fr { fn mul_add_assign(&mut self, a: &'a Self, b: &'b Self) { - *self = *self + *a + *b; + *self = *self + a * b; } - } #[cfg(test)] diff --git a/src/bn256/fr_sp1.rs b/src/bn256/fr_sp1.rs index 39b8497f..b1e2e46e 100644 --- a/src/bn256/fr_sp1.rs +++ b/src/bn256/fr_sp1.rs @@ -132,7 +132,7 @@ impl Fr { CtOption::new(Fr(tmp), Choice::from(is_some)) } - pub fn from_raw(limbs: [u64; 4]) -> Fr { + pub const fn from_raw(limbs: [u64; 4]) -> Fr { // FIXME: handle limbs that are larger than modulus. let mut tmp = [0, 0, 0, 0, 0, 0, 0, 0];