Skip to content

Commit

Permalink
o1vm/mips: use alloc_scratch_inverse for the inverse
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Nov 21, 2024
1 parent f275f80 commit e6169b1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions o1vm/src/interpreters/mips/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,13 @@ impl<Fp: Field, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp, PreI
let res = if *x == 0 { 1 } else { 0 };
self.write_column(pos, res);
// write the non deterministic advice inv_or_zero
let pos = self.alloc_scratch();
let inv_or_zero = if *x == 0 {
Fp::zero()
if *x == 0 {
let pos = self.alloc_scratch();
self.write_field_column(pos, Fp::zero());
} else {
Fp::inverse(&Fp::from(*x)).unwrap()
let pos = self.alloc_scratch_inverse();
self.write_field_column(pos, Fp::from(*x));
};
self.write_field_column(pos, inv_or_zero);
// return the result
res
}
Expand All @@ -353,13 +353,13 @@ impl<Fp: Field, PreImageOracle: PreImageOracleT> InterpreterEnv for Env<Fp, PreI
is_zero
};
let _to_zero_test_inv_or_zero = {
let pos = self.alloc_scratch();
let inv_or_zero = if to_zero_test == Fp::zero() {
Fp::zero()
if to_zero_test == Fp::zero() {
let pos = self.alloc_scratch();
self.write_field_column(pos, Fp::zero());
} else {
Fp::inverse(&to_zero_test).unwrap()
let pos = self.alloc_scratch_inverse();
self.write_field_column(pos, to_zero_test);
};
self.write_field_column(pos, inv_or_zero);
1 // Placeholder value
};
res
Expand Down

0 comments on commit e6169b1

Please sign in to comment.