diff --git a/o1vm/src/interpreters/mips/constraints.rs b/o1vm/src/interpreters/mips/constraints.rs index 7e97317bbd..cb46508b9b 100644 --- a/o1vm/src/interpreters/mips/constraints.rs +++ b/o1vm/src/interpreters/mips/constraints.rs @@ -227,7 +227,7 @@ impl InterpreterEnv for Env { unsafe { self.test_zero(x, pos) } }; let x_inv_or_zero = { - let pos = self.alloc_scratch(); + let pos = self.alloc_scratch_inverse(); self.variable(pos) }; // If x = 0, then res = 1 and x_inv_or_zero = 0 diff --git a/o1vm/src/interpreters/mips/witness.rs b/o1vm/src/interpreters/mips/witness.rs index 958e96771f..df695daeb7 100644 --- a/o1vm/src/interpreters/mips/witness.rs +++ b/o1vm/src/interpreters/mips/witness.rs @@ -329,15 +329,15 @@ impl InterpreterEnv for Env Self::Variable { // write the result - let pos = self.alloc_scratch(); - let res = if *x == 0 { 1 } else { 0 }; - self.write_column(pos, res); + let res = { + let pos = self.alloc_scratch(); + unsafe { self.test_zero(x, pos) } + }; // write the non deterministic advice inv_or_zero + let pos = self.alloc_scratch_inverse(); if *x == 0 { - let pos = self.alloc_scratch(); self.write_field_column(pos, Fp::zero()); } else { - let pos = self.alloc_scratch_inverse(); self.write_field_column(pos, Fp::from(*x)); }; // return the result @@ -354,11 +354,10 @@ impl InterpreterEnv for Env