|
|
@@ -83,7 +83,7 @@ pub fn bitrep_scalars_vartime<S: PrimeField>(upper: S) -> Result<Vec<S>, Error>
|
|
|
|
|
|
// Make the vector of Scalars containing the represented value of
|
|
|
// the bits
|
|
|
- Ok((0..nbits)
|
|
|
+ let res = Ok((0..nbits)
|
|
|
.map(|i| {
|
|
|
if i < nbits - 1 {
|
|
|
S::from_u128(1u128 << i)
|
|
|
@@ -92,7 +92,10 @@ pub fn bitrep_scalars_vartime<S: PrimeField>(upper: S) -> Result<Vec<S>, Error>
|
|
|
S::from_u128(upper_val - (1u128 << (nbits - 1)))
|
|
|
}
|
|
|
})
|
|
|
- .collect())
|
|
|
+ .collect());
|
|
|
+ super::dumper::dump(&format!("res = {res:?}\n"));
|
|
|
+
|
|
|
+ res
|
|
|
}
|
|
|
|
|
|
/// Given a vector of [`Scalar`]s as output by
|
|
|
@@ -113,6 +116,7 @@ pub fn compute_bitrep<S: PrimeField>(mut x: S, bitrep_scalars: &[S]) -> Vec<Choi
|
|
|
// Decompose `x` as a normal `nbit`-bit vector. This only looks at
|
|
|
// the low `nbits` bits of `x`, so the resulting bit vector forces
|
|
|
// `x < 2^{nbits}`.
|
|
|
+ super::dumper::dump(&format!("x = {x:?}\n"));
|
|
|
let x_raw_bits = bit_decomp(x, nbits);
|
|
|
let high_bit = x_raw_bits[(nbits as usize) - 1];
|
|
|
|
|
|
@@ -130,6 +134,7 @@ pub fn compute_bitrep<S: PrimeField>(mut x: S, bitrep_scalars: &[S]) -> Vec<Choi
|
|
|
// and tack on the high bit
|
|
|
x_bits.push(high_bit);
|
|
|
|
|
|
+ super::dumper::dump(&format!("x_bits = {x_bits:?}\n"));
|
|
|
x_bits
|
|
|
}
|
|
|
|