Skip to content

Commit

Permalink
Fixed implies_u64
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-barrett committed Aug 15, 2023
1 parent 110f719 commit 184b13e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/circuit/gadgets/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,12 @@ fn implies_u64<F: LurkField, CS: ConstraintSystem<F>>(
let mut a_u64 = a.get_value().and_then(|a| a.to_u64()).unwrap_or(0);

let mut bits: Vec<Boolean> = vec![];
for _ in 0..64 {
let b = a_u64 % 2;
let b_bool = Boolean::Constant(b == 1);
for i in 0..64 {
let b = a_u64 & 1;
let b_bool = Boolean::Is(AllocatedBit::alloc(
&mut cs.namespace(|| format!("b.{i}")),
Some(b == 1),
)?);
bits.push(b_bool);

a_u64 /= 2;
Expand Down

0 comments on commit 184b13e

Please sign in to comment.