This commit is contained in:
Nicholas Ward 2022-09-26 10:44:51 -07:00
parent d239d3ffb5
commit 59acd9436c
2 changed files with 7 additions and 3 deletions

View File

@ -301,7 +301,8 @@ impl GoldilocksField {
if self.is_zero() {
Some(*self)
} else if self.is_quadratic_residue() {
let t = (Self::order() - BigUint::from(1u32)) / (BigUint::from(2u32).pow(Self::TWO_ADICITY as u32));
let t = (Self::order() - BigUint::from(1u32))
/ (BigUint::from(2u32).pow(Self::TWO_ADICITY as u32));
let mut z = Self::POWER_OF_TWO_GENERATOR.exp_biguint(&t);
let mut w = self.exp_biguint(&((t - BigUint::from(1u32)) / BigUint::from(2u32)));
let mut x = w * *self;
@ -332,7 +333,6 @@ impl GoldilocksField {
None
}
}
}
/// Fast addition modulo ORDER for x86-64.

View File

@ -24,7 +24,11 @@ impl SimpleGenerator<GoldilocksField> for SquareRootGenerator<GoldilocksField, 2
vec![self.x_squared]
}
fn run_once(&self, witness: &PartitionWitness<GoldilocksField>, out_buffer: &mut GeneratedValues<GoldilocksField>) {
fn run_once(
&self,
witness: &PartitionWitness<GoldilocksField>,
out_buffer: &mut GeneratedValues<GoldilocksField>,
) {
let x_squared = witness.get_target(self.x_squared);
let x = x_squared.sqrt().unwrap();