From ee8762fdb84667aa12fb030a37632e1506218073 Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 11 Jan 2023 15:34:51 +0100 Subject: [PATCH] read_memory now panic instead of just displaying the error and continue the execution --- src/simulator/machine.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/simulator/machine.rs b/src/simulator/machine.rs index 57f4550..d63ea1e 100644 --- a/src/simulator/machine.rs +++ b/src/simulator/machine.rs @@ -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; @@ -379,5 +379,5 @@ impl Machine { #[cfg(test)] mod test { use super::Machine; - + }