Changed magic

pull/2/head
ondra05 2023-08-01 22:20:11 +02:00
parent 8cfcf17736
commit 3597881651
No known key found for this signature in database
GPG Key ID: 0DA6D2BB2285E881
3 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ impl Assembler {
/// Why 12 bytes? That's the size of largest instruction parameter part.
pub fn finalise(&mut self) {
self.buf.extend([0; 12]);
self.buf[0..3].copy_from_slice(&[0xAB, 0x1E, 0x0B]);
self.buf[0..4].copy_from_slice(&0xAB1E0B_u32.to_le_bytes());
}
}

View File

@ -40,7 +40,7 @@ macro_rules! gen_valider {
/// sound to execute.
pub fn validate(mut program: &[u8]) -> Result<(), Error> {
// Validate magic
if program.get(0..3) != Some(&[0xAB, 0x1E, 0x0B]) {
if program.get(0..4) != Some(&0xAB1E0B_u32.to_le_bytes()) {
return Err(Error {
kind: ErrorKind::MissingMagic,
index: 0,
@ -67,7 +67,7 @@ macro_rules! gen_valider {
}
let start = program;
program = &program[3..];
program = &program[4..];
loop {
use crate::opcode::*;
program = match program {

View File

@ -73,7 +73,7 @@ impl<'a, PfHandler: HandlePageFault, const TIMER_QUOTIENT: usize>
pfhandler: traph,
pc: 0,
program_len: program.len() - 12,
program: &program[3..],
program: &program[4..],
timer: 0,
copier: None,
}