// Verify the header magic number and return the next value in the header.
Verify the header magic number and return the next value in the header.
Verify the header magic number and return the next value in the header .
fn verify_and_read_header(bytecode: &Vec<u8>, magic_num: u32) -> Result<u32, BytecodeError> {
    let parsed_magic_num = u32::from_be_bytes(get_u32_bytes(bytecode, 0)?);
    if parsed_magic_num != magic_num {
        return Err(BytecodeError::InvalidHeader(magic_num, parsed_magic_num));
    }
    Ok(u32::from_le_bytes(get_u32_bytes(bytecode, 4)?))
}
fn verify_and_read_header ( bytecode : & Vec < u8 > , magic_num : u32 ) -> Result < u32 , BytecodeError > { let parsed_magic_num = u32 :: from_be_bytes ( get_u32_bytes ( bytecode , 0 ) ? ) ; if parsed_magic_num != magic_num { return Err ( BytecodeError :: InvalidHeader ( magic_num , parsed_magic_num ) ) ; } Ok ( u32 :: from_le_bytes ( get_u32_bytes ( bytecode , 4 ) ? ) ) }
Verify the header magic number and return the next value in the header.
Verify the header magic number and return the next value in the header .
bytecode
&Vec<u8>
magic_num
u32