From cb1cfde0c44b059bdae147475bcde5cccac2a4e5 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Nov 2023 21:45:47 +0000 Subject: Added instruction to get the size of some allocation This will allow for more library level code to be written. For example, say you wanted to write a generic byte level reversal algorithm for dynamically sized allocations. Getting the size of the allocation would be fundamental to this operation. --- lib/inst.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/inst.h') diff --git a/lib/inst.h b/lib/inst.h index 29cbd55..21fc6a1 100644 --- a/lib/inst.h +++ b/lib/inst.h @@ -55,6 +55,7 @@ typedef enum OP_MGET_HWORD, OP_MGET_WORD, OP_MDELETE, + OP_MSIZE, // Boolean operations OP_NOT_BYTE, @@ -189,6 +190,7 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_MGET(TYPE, OP) \ ((inst_t){.opcode = OP_MGET_##TYPE, .operand = DWORD(OP)}) #define INST_MDELETE ((inst_t){.opcode = OP_MDELETE}) +#define INST_MSIZE ((inst_t){.opcode = OP_MSIZE}) #define INST_NOT(TYPE) ((inst_t){.opcode = OP_NOT_##TYPE}) #define INST_OR(TYPE) ((inst_t){.opcode = OP_OR_##TYPE}) -- cgit v1.2.3-13-gbd6f