aboutsummaryrefslogtreecommitdiff
path: root/src/simulator.rs
diff options
context:
space:
mode:
authorDavid Li <li.davidm96@gmail.com>2015-12-20 15:23:13 -0500
committerDavid Li <li.davidm96@gmail.com>2015-12-20 15:23:13 -0500
commitde3428fe0a808ffd693675583992a39aa4247287 (patch)
treea6427df6b4b221c1e3d91a0bfb18790e91374e80 /src/simulator.rs
parent9888788cd4894c0c00f7373fc0cd6915941d638d (diff)
Fix compile errors
Diffstat (limited to 'src/simulator.rs')
-rw-r--r--src/simulator.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/simulator.rs b/src/simulator.rs
index 3ca11d9..7e7051c 100644
--- a/src/simulator.rs
+++ b/src/simulator.rs
@@ -107,15 +107,15 @@ impl Simulator {
core.running = false;
}
else {
- let target = (((pc as i32) + inst.i_imm()) & 0xFFFFFFFE) as usize;
- core.registers.write_word(inst.rd(), pc + 4);
+ let target = (((pc as i32) + inst.i_imm()) as usize) & 0xFFFFFFFE;
+ core.registers.write_word(inst.rd(), (pc + 4) as u32);
core.pc = target;
return;
}
},
isa::opcodes::JAL => {
let target = ((pc as i32) + inst.uj_imm()) as usize;
- core.registers.write_word(inst.rd(), pc + 4);
+ core.registers.write_word(inst.rd(), (pc + 4) as u32);
core.pc = target;
return;
}