addressed nits

This commit is contained in:
Nicholas Ward 2021-11-09 16:36:29 -08:00
parent c861c10a5b
commit cf3b6df0e4
2 changed files with 4 additions and 6 deletions

View File

@ -57,10 +57,8 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
};
if let (Some(a), Some(b)) = (first_term_const, z_const) {
let sum_u64 = (a + b).to_canonical_u64();
let (low_u64, high_u64) = (sum_u64 % (1u64 << 32), sum_u64 >> 32);
let low = F::from_canonical_u64(low_u64);
let high = F::from_canonical_u64(high_u64);
let sum = (a + b).to_canonical_u64();
let (low, high) = (sum as u32, (sum >> 32) as u32);
return Some((self.constant_u32(low), self.constant_u32(high)));
}

View File

@ -318,8 +318,8 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
}
/// Returns a U32Target for the value `c`, which is assumed to be at most 32 bits.
pub fn constant_u32(&mut self, c: F) -> U32Target {
U32Target(self.constant(c))
pub fn constant_u32(&mut self, c: u32) -> U32Target {
U32Target(self.constant(F::from_canonical_u32(c)))
}
/// If the given target is a constant (i.e. it was created by the `constant(F)` method), returns