diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-09-14 01:45:31 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 35200031e88c65da6a0bde563f20d95c1dd4f464 (patch) | |
tree | b1159960ca7ba78a42f6ef203f99d2b1a1c26641 /include/bytecode | |
parent | 7d663615b2a44715e7447a40cae467d7d4e38b9c (diff) |
Use struct for bytecode header instead of pointer arithmetic
Diffstat (limited to 'include/bytecode')
-rw-r--r-- | include/bytecode/bytecode.h | 11 |
1 files changed, 11 insertions, 0 deletions
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 @@ -83,6 +83,17 @@ 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 { u32 func_offset; u8 num_params; u32 params_num_pointers; |