new add + mul by residue + 1

This commit is contained in:
ValarDragon
2021-02-05 20:13:02 -06:00
parent 64ece6414f
commit cd60d33bcb

View File

@@ -44,6 +44,15 @@ impl Fp2Parameters for Fq2Parameters {
*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 {