Optimizations to field and curve arithmetic

This commit is contained in:
Pratyush Mishra
2022-09-12 22:03:00 -07:00
parent 363426c1d4
commit 68f500da01
13 changed files with 82 additions and 39 deletions

View File

@@ -77,11 +77,12 @@ impl Fp3Config for Fq3Config {
];
#[inline(always)]
fn mul_fp_by_nonresidue(fe: &Self::Fp) -> Self::Fp {
fn mul_fp_by_nonresidue_in_place(fe: &mut Self::Fp) -> &mut Self::Fp {
let original = *fe;
let mut four_fe = fe.double();
four_fe.double_in_place();
let eight_fe = four_fe.double();
eight_fe + &four_fe + &original
fe.double_in_place();
*fe += original;
fe.double_in_place().double_in_place();
*fe += original;
fe
}
}