Skip to content

Commit

Permalink
lint and format
Browse files Browse the repository at this point in the history
  • Loading branch information
svv232 authored and dannywillems committed Dec 24, 2024
1 parent 84ffa12 commit fa494c3
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions o1vm/src/interpreters/riscv32im/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2267,33 +2267,33 @@ pub fn interpret_sbtype<Env: InterpreterEnv>(env: &mut Env, instr: SBInstruction
env.set_next_instruction_pointer(addr);
}
SBInstruction::BranchLessThan => {
// blt: if (x[rs1] < x[rs2]) pc += sext(offset)
let local_rs1 = env.read_register(&rs1);
let local_rs2 = env.read_register(&rs2);
let rd_scratch = env.alloc_scratch();
let less_than =
unsafe { env.test_less_than_signed(&local_rs1, &local_rs2, rd_scratch) };
let offset = (less_than.clone()) * imm0_12
+ (Env::constant(1) - less_than.clone()) * Env::constant(4);
let addr = {
let res_scratch = env.alloc_scratch();
let overflow_scratch = env.alloc_scratch();
let (res, _overflow) = unsafe {
env.add_witness(
&next_instruction_pointer,
&offset,
res_scratch,
overflow_scratch,
)
};
// FIXME: Requires a range check
res
};
env.set_instruction_pointer(next_instruction_pointer);
env.set_next_instruction_pointer(addr);
// blt: if (x[rs1] < x[rs2]) pc += sext(offset)
let local_rs1 = env.read_register(&rs1);
let local_rs2 = env.read_register(&rs2);

let rd_scratch = env.alloc_scratch();

let less_than =
unsafe { env.test_less_than_signed(&local_rs1, &local_rs2, rd_scratch) };
let offset = (less_than.clone()) * imm0_12
+ (Env::constant(1) - less_than.clone()) * Env::constant(4);

let addr = {
let res_scratch = env.alloc_scratch();
let overflow_scratch = env.alloc_scratch();
let (res, _overflow) = unsafe {
env.add_witness(
&next_instruction_pointer,
&offset,
res_scratch,
overflow_scratch,
)
};
// FIXME: Requires a range check
res
};
env.set_instruction_pointer(next_instruction_pointer);
env.set_next_instruction_pointer(addr);
}
SBInstruction::BranchGreaterThanEqual => {
unimplemented!("BranchGreaterThanEqual")
Expand Down

0 comments on commit fa494c3

Please sign in to comment.