We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e25a744 commit 8e1a0e7Copy full SHA for 8e1a0e7
src/r1cs/fqvar_ext.rs
@@ -85,13 +85,11 @@ impl FqVarExtension for FqVar {
85
// bytes[0] & 1 == 0
86
let true_var = Boolean::<Fq>::TRUE;
87
let false_var = Boolean::<Fq>::FALSE;
88
- let mut is_nonnegative_var = true_var.clone();
89
- // Check first 8 bits
90
- for _ in 0..8 {
91
- let lhs = bitvars[0].and(&true_var.clone())?;
92
- let this_loop_var = lhs.is_eq(&false_var)?;
93
- is_nonnegative_var = is_nonnegative_var.and(&this_loop_var)?;
94
- }
+
+ // Check least significant bit
+ let lhs = bitvars[0].and(&true_var)?;
+ let is_nonnegative_var = lhs.is_eq(&false_var)?;
95
Ok(is_nonnegative_var)
96
}
97
0 commit comments