Skip to content

Commit

Permalink
fix: use first array for zipped_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
yi-sun committed Jan 9, 2025
1 parent 658e7bf commit 24155b5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
34 changes: 17 additions & 17 deletions extensions/native/compiler/src/asm/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,7 @@ impl<F: PrimeField32 + TwoAdicField, EF: ExtensionField<F> + TwoAdicField> IfCom
}
}

// Zipped for loop -- loop extends over the first entry in starts and ends
pub struct ZipForCompiler<'a, F: Field, EF> {
compiler: &'a mut AsmCompiler<F, EF>,
starts: Vec<RVar<F>>,
Expand Down Expand Up @@ -890,23 +891,22 @@ impl<F: PrimeField32 + TwoAdicField, EF: ExtensionField<F> + TwoAdicField>
});

self.compiler.basic_block();
self.ends
.iter()
.zip(self.loop_vars.iter())
.for_each(|(end, loop_var)| match end {
RVar::Const(end) => {
self.compiler.push(
AsmInstruction::BneI(loop_label, loop_var.fp(), *end),
debug_info.clone(),
);
}
RVar::Val(end) => {
self.compiler.push(
AsmInstruction::Bne(loop_label, loop_var.fp(), end.fp()),
debug_info.clone(),
);
}
});
let end = self.ends[0];
let loop_var = self.loop_vars[0];
match end {
RVar::Const(end) => {
self.compiler.push(
AsmInstruction::BneI(loop_label, loop_var.fp(), end),
debug_info.clone(),
);
}
RVar::Val(end) => {
self.compiler.push(
AsmInstruction::Bne(loop_label, loop_var.fp(), end.fp()),
debug_info.clone(),
);
}
};

let label = self.compiler.block_label();
let instr = AsmInstruction::j(label);
Expand Down
2 changes: 2 additions & 0 deletions extensions/native/recursion/src/fri/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ pub fn verify_batch<C: Config + 'static>(
let sibling = builder.iter_ptr_get(&proof, ptr_vec[0]).ptr();
let bit = builder.iter_ptr_get(&index_bits, ptr_vec[1]);

builder.print_v(sibling.address);

builder.if_eq(bit, C::N::ONE).then_or_else(
|builder| {
builder.assign(&left, sibling);
Expand Down

0 comments on commit 24155b5

Please sign in to comment.