Skip to content
Permalink
Browse files

Clean up a few loop bounds

  • Loading branch information
huitseeker authored and Pratyush committed Dec 2, 2019
1 parent 23ec653 commit a6f6f1dcef038d2c21366883637940339a2a97bf
Showing with 4 additions and 4 deletions.
  1. +1 −1 algebra/src/to_field_vec.rs
  2. +1 −1 ff-fft/src/polynomial/dense.rs
  3. +1 −1 gm17/src/r1cs_to_sap.rs
  4. +1 −1 r1cs-std/src/fields/mod.rs
@@ -114,7 +114,7 @@ impl<ConstraintF: PrimeField> ToConstraintField<ConstraintF> for [u8] {
.map(|chunk| {
let mut chunk = chunk.to_vec();
let len = chunk.len();
for _ in len..(max_size + 1) {
for _ in len..=max_size {
chunk.push(0u8);
}
ConstraintF::read(chunk.as_slice())
@@ -121,7 +121,7 @@ impl<F: Field> DensePolynomial<F> {
/// from the field `F`.
pub fn rand<R: Rng>(d: usize, rng: &mut R) -> Self {
let mut random_coeffs = Vec::new();
for _ in 0..(d + 1) {
for _ in 0..=d {
random_coeffs.push(F::rand(rng));
}
Self::from_coefficients_vec(random_coeffs)
@@ -75,7 +75,7 @@ impl R1CStoSAP {
a[0].add_assign(&u[extra_constr_offset]);
c[0].add_assign(&u[extra_constr_offset]);

for i in 1..(assembly.num_inputs - 1) + 1 {
for i in 1..assembly.num_inputs {
// First extra constraint

a[i].add_assign(&u[extra_constr_offset + 2 * i - 1]);
@@ -460,7 +460,7 @@ mod test {
maxpower: usize,
) {
let mut rng = XorShiftRng::seed_from_u64(1231275789u64);
for i in 0..(maxpower + 1) {
for i in 0..=maxpower {
let mut a = FE::rand(&mut rng);
let mut a_gadget = F::alloc(cs.ns(|| format!("a_gadget_{:?}", i)), || Ok(a)).unwrap();
a_gadget = a_gadget

0 comments on commit a6f6f1d

Please sign in to comment.
You can’t perform that action at this time.