Skip to content

Commit

Permalink
Improve FixedEvaluator implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Dec 20, 2024
1 parent e48538a commit 71f0570
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion executor/src/witgen/jit/block_machine_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@ impl<T: FieldElement> FixedEvaluator<T> for &BlockMachineProcessor<'_, T> {
fn evaluate(&self, var: &AlgebraicReference, row_offset: i32) -> Option<T> {
assert!(var.is_fixed());
let values = self.fixed_data.fixed_cols[&var.poly_id].values_max_size();
let row = (row_offset + var.next as i32 + values.len() as i32) as usize % values.len();

// By assumption of the block machine, all fixed columns are cyclic with a period of <block_size>.
// An exception might be the first and last row.
assert!(row_offset >= -1);
assert!(self.block_size >= 1);
// The current row is guaranteed to be at least 1.
let current_row = (2 * self.block_size as i32 + row_offset) as usize;
let row = current_row + var.next as usize;
Some(values[row])
}
}
Expand Down

0 comments on commit 71f0570

Please sign in to comment.