Skip to content
Prev Previous commit
Next Next commit
Fix unarynot
  • Loading branch information
ShaharNaveh committed Jan 5, 2026
commit 0696124edf140b0f926151241e6e13230ebb4839
5 changes: 4 additions & 1 deletion crates/jit/src/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,10 @@ impl<'a, 'b> FunctionCompiler<'a, 'b> {
Ok(())
}
Instruction::UnaryNot => {
let boolean = self.stack.pop().ok_or(JitCompileError::BadBytecode)?;
let boolean = match self.stack.pop().ok_or(JitCompileError::BadBytecode)? {
JitValue::Bool(val) => val,
_ => return Err(JitCompileError::BadBytecode),
};
let not_boolean = self.builder.ins().bxor_imm(boolean, 1);
self.stack.push(JitValue::Bool(not_boolean));
Ok(())
Expand Down
Loading