Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
introduce assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
ashWhiteHat committed Jan 25, 2022
1 parent ef05763 commit 6710592
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/bn256/fq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,8 @@ impl ff::PrimeField for Fq {
fn to_repr(&self) -> Self::Repr {
// Turn into canonical form by computing
// (a.R) / R = a
let tmp = Self::montgomery_reduce(self.0[0], self.0[1], self.0[2], self.0[3], 0, 0, 0, 0);
let tmp =
Self::montgomery_reduce(&[self.0[0], self.0[1], self.0[2], self.0[3], 0, 0, 0, 0]);

let mut res = [0; 32];
res[0..8].copy_from_slice(&tmp.0[0].to_le_bytes());
Expand Down Expand Up @@ -1550,7 +1551,7 @@ impl FieldExt for Fq {
/// Gets the lower 128 bits of this field element when expressed
/// canonically.
fn get_lower_128(&self) -> u128 {
let tmp = Fq::montgomery_reduce(self.0[0], self.0[1], self.0[2], self.0[3], 0, 0, 0, 0);
let tmp = Fq::montgomery_reduce(&[self.0[0], self.0[1], self.0[2], self.0[3], 0, 0, 0, 0]);

u128::from(tmp.0[0]) | (u128::from(tmp.0[1]) << 64)
}
Expand Down

0 comments on commit 6710592

Please sign in to comment.