From 6038363d2facd5c8a79d9c4920ca5b3cf70bef95 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 16 Oct 2023 01:06:49 +0100 Subject: Added functionality to read and write instruction bytecode Uses some bit hacks to quickly check what data type an opcode may have by shifting down to units then casting it to a data_type_t. Not very well tested yet, we'll need to see now. --- src/base.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/base.h') diff --git a/src/base.h b/src/base.h index 0e822d5..670aa81 100644 --- a/src/base.h +++ b/src/base.h @@ -35,6 +35,14 @@ typedef union f64 as_float; } data_t; +typedef enum +{ + DATA_TYPE_NIL = 0, + DATA_TYPE_BYTE = 1, + DATA_TYPE_WORD = 3, + DATA_TYPE_FLOAT = 5, +} data_type_t; + #define DBYTE(BYTE) ((data_t){.as_byte = (BYTE)}) #define DWORD(WORD) ((data_t){.as_word = (WORD)}) #define DFLOAT(FLOAT) ((data_t){.as_float = (FLOAT)}) -- cgit v1.2.3-13-gbd6f