Skip to content

Commit

Permalink
Correct index on code_ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoRiether committed Sep 28, 2023
1 parent afd922f commit fce131a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/simulator/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn next(sim: &mut Simulator, code: &[Executor], new_pc: usize) {
" [error]".bright_red(),
byte_msg,
" Note".bright_yellow(),
sim.code_ctx[sim.pc]
sim.code_ctx[sim.pc >> 2]
);
std::process::exit(1);
}
Expand All @@ -53,7 +53,7 @@ pub fn next(sim: &mut Simulator, code: &[Executor], new_pc: usize) {
"Tried to access instruction at pc {:x}, but code is only {:x} bytes long.\nLast instruction executed: {}",
new_pc,
sim.code.len() * 4,
sim.code_ctx[sim.pc],
sim.code_ctx[sim.pc >> 2],
);
std::process::exit(1);
});
Expand Down

0 comments on commit fce131a

Please sign in to comment.