Skip to content

Commit

Permalink
Define the column structure
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Feb 28, 2024
1 parent e061d34 commit f9d19e3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions msm/src/serialization/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,24 @@ impl<const N: usize, Fp: Field> InterpreterEnv for Env<N, Fp> {
}
}

impl<const N: usize, Fp: Field> Env<N, Fp> {
pub fn write_column(&mut self, position: Column, value: u128) {
match position {
Column::X(i) => {
if i < 3 {
self.current_kimchi_limbs[i] = Fp::from(value);
} else if i < 3 + LIMBS_NUM {
self.msm_limbs[i - 3] = Fp::from(value);
} else if i < 3 + LIMBS_NUM + 19 {
self.intermediate_limbs[i - 3 - LIMBS_NUM] = Fp::from(value);
} else {
panic!("Invalid column index")
}
}
}
}
}

impl<const N: usize, Fp: Field> Env<N, Fp> {
pub fn create(kimchi_limbs: [[Fp; 3]; N]) -> Self {
Self {
Expand Down

0 comments on commit f9d19e3

Please sign in to comment.