This commit is contained in:
Nicholas Ward 2021-11-09 17:49:41 -08:00
parent 3f619c704c
commit 7336aa0917
2 changed files with 16 additions and 3 deletions

View File

@ -93,8 +93,18 @@ mod tests {
.map(|_| rng.gen_range(0..(1 << num_bits)))
.collect();
let a_biguint = BigUint::from_slice(&lst1.iter().flat_map(|&x| [x as u32, (x >> 32) as u32]).collect::<Vec<_>>());
let b_biguint = BigUint::from_slice(&lst2.iter().flat_map(|&x| [x as u32, (x >> 32) as u32]).collect::<Vec<_>>());
let a_biguint = BigUint::from_slice(
&lst1
.iter()
.flat_map(|&x| [x as u32, (x >> 32) as u32])
.collect::<Vec<_>>(),
);
let b_biguint = BigUint::from_slice(
&lst2
.iter()
.flat_map(|&x| [x as u32, (x >> 32) as u32])
.collect::<Vec<_>>(),
);
let a = lst1
.iter()

View File

@ -102,7 +102,10 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
}
}
fn reduce_nonnative<FF: Field>(&mut self, x: &ForeignFieldTarget<FF>) -> ForeignFieldTarget<FF> {
fn reduce_nonnative<FF: Field>(
&mut self,
x: &ForeignFieldTarget<FF>,
) -> ForeignFieldTarget<FF> {
let x_biguint = self.nonnative_to_biguint(x);
self.reduce(&x_biguint)
}