arnaucube
arnaucube/ark-curves-cherry-pickedPublic Self-hosted repository
new add + mul by residue + 1
ValarDragon dojha12@gmail.com
Fri, 05 Feb 2021 20:13:02 -0600
commit

cd60d33bcb93aa7b86643dcced102d6f059aba1c

parent

64ece6414f731050df64a36b2ab409189ca14df2

1 files changed, 9 insertions(+), 0 deletions(-)

jump to
M bls12_377/src/fields/fq2.rs → bls12_377/src/fields/fq2.rs

@@ -44,6 +44,15 @@ c += y;

*x - c } + // x + y + (-5 * y), computed as x - 4*y + #[inline(always)] + fn add_and_mul_fp_by_nonresidue_plus_one(x: &Self::Fp, y: &Self::Fp) -> Self::Fp { + // c becomes 4 * y + let mut c = y.double(); + c.double_in_place(); + *x - c + } + // x - (-5 * y), computed as x + 5*y #[inline(always)] fn sub_and_mul_fp_by_nonresidue(x: &Self::Fp, y: &Self::Fp) -> Self::Fp {