Browse Source

new add + mul by residue + 1

fq2_neg_nonresidue
ValarDragon 3 years ago
parent
commit
cd60d33bcb
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      bls12_377/src/fields/fq2.rs

+ 9
- 0
bls12_377/src/fields/fq2.rs

@ -44,6 +44,15 @@ impl Fp2Parameters for Fq2Parameters {
*x - c *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 // x - (-5 * y), computed as x + 5*y
#[inline(always)] #[inline(always)]
fn sub_and_mul_fp_by_nonresidue(x: &Self::Fp, y: &Self::Fp) -> Self::Fp { fn sub_and_mul_fp_by_nonresidue(x: &Self::Fp, y: &Self::Fp) -> Self::Fp {

Loading…
Cancel
Save