This commit is contained in:
Patrick 2024-11-25 20:33:02 +01:00
parent 51f7d7214a
commit c495465a8c
2 changed files with 4 additions and 4 deletions

View file

@ -29,8 +29,8 @@ impl CPU<u8> for ExampleCPU {
registers: [0; 4],
};
let len = initial_state.len();
let ram_len = instance.ram.len();
let len: usize = initial_state.len();
let ram_len: usize = instance.ram.len();
if len >= ram_len {
instance.ram.copy_from_slice(&initial_state[..ram_len]);

View file

@ -17,8 +17,8 @@ pub fn save_binary_u8(file_path: &str, content: Vec<u8>) {
}
pub fn load_binary_u8(file_path: &str) -> Vec<u8> {
let mut file = File::open(file_path).unwrap();
let mut buffer = Vec::new();
let mut file: File = File::open(file_path).unwrap();
let mut buffer: Vec<u8> = Vec::new();
file.read_to_end(&mut buffer).unwrap();
buffer
}