read_memory now panic instead of just displaying the error and continue the execution

This commit is contained in:
Quentin Legot 2023-01-11 15:34:51 +01:00
parent f4b6cb3137
commit ee8762fdb8

View File

@ -44,7 +44,7 @@ impl Machine {
/// - **address** in the memory to read
pub fn read_memory(machine : &mut Machine, size : i32, address : usize) -> u64 {
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;