From 35200031e88c65da6a0bde563f20d95c1dd4f464 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 14 Sep 2019 01:45:31 +0200 Subject: Use struct for bytecode header instead of pointer arithmetic --- include/bytecode/bytecode.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/bytecode') diff --git a/include/bytecode/bytecode.h b/include/bytecode/bytecode.h index a93fe4f..83d62b9 100644 --- a/include/bytecode/bytecode.h +++ b/include/bytecode/bytecode.h @@ -80,6 +80,17 @@ typedef enum { typedef u8 AmalOpcodeType; +/* TODO: Make sure this pragma pack works on all platforms */ +#pragma pack(push, 1) +typedef struct { + u32 magic_number; /* AMAL_BYTECODE_MAGIC_NUMBER */ + u8 major_version; + u8 minor_version; + u8 patch_version; + u8 endian; /* 0 = little endian, 1 = big endian */ +} BytecodeHeader; +#pragma pack(pop) + /* TODO: Make sure this pragma pack works on all platforms */ #pragma pack(push, 1) typedef struct { -- cgit v1.2.3