read_memory now panic instead of just displaying the error and continue the execution
This commit is contained in:
parent
f4b6cb3137
commit
ee8762fdb8
@ -44,7 +44,7 @@ impl Machine {
|
|||||||
/// - **address** in the memory to read
|
/// - **address** in the memory to read
|
||||||
pub fn read_memory(machine : &mut Machine, size : i32, address : usize) -> u64 {
|
pub fn read_memory(machine : &mut Machine, size : i32, address : usize) -> u64 {
|
||||||
if size != 1 && size != 2 && size != 4 && size != 8 {
|
if size != 1 && size != 2 && size != 4 && size != 8 {
|
||||||
println!("ERROR read_memory : wrong size parameter {}, must be (1, 2, 4 or 8)", size);
|
panic!("ERROR read_memory : wrong size parameter {}, must be (1, 2, 4 or 8)", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut ret : u64 = machine.main_memory[address] as u64;
|
let mut ret : u64 = machine.main_memory[address] as u64;
|
||||||
|
Loading…
Reference in New Issue
Block a user