Skip to content

Commit

Permalink
some fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lightsing committed Aug 22, 2024
1 parent 6c89e7b commit d0a7424
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/bn256/fr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions src/bn256/fr_sp1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl Fr {
Fr([1, 0, 0, 0, 0, 0, 0, 0])
}

pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Fr> {
pub const fn from_bytes(bytes: &[u8; 32]) -> CtOption<Fr> {
let mut tmp = [0, 0, 0, 0, 0, 0, 0, 0];

tmp[0] = u32::from_le_bytes(bytes[0..4].try_into().unwrap());
Expand All @@ -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];

Expand Down

0 comments on commit d0a7424

Please sign in to comment.