From 99b0ebdfa6e05b202e4ce900f95aef12f2214f69 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 2 Nov 2023 20:35:47 +0000 Subject: Small fixes --- lib/base.h | 2 +- lib/inst.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/base.h b/lib/base.h index e0cabc0..1eaf9ba 100644 --- a/lib/base.h +++ b/lib/base.h @@ -77,7 +77,7 @@ typedef enum #define SWORD_SIZE sizeof(s_word) // Macros to extract the nth byte or nth hword from a word -#define WORD_NTH_BYTE(WORD, N) (((WORD) >> ((N)*8)) & 0xff) +#define WORD_NTH_BYTE(WORD, N) (((WORD) >> ((N)*8)) & 0xFF) #define WORD_NTH_HWORD(WORD, N) (((WORD) >> ((N)*2)) & 0xFFFFFFFF) // Assume array contains 4 bytes. diff --git a/lib/inst.h b/lib/inst.h index 10f8dc7..63b1669 100644 --- a/lib/inst.h +++ b/lib/inst.h @@ -229,8 +229,9 @@ inst_t *insts_read_bytecode_file(FILE *, size_t *); #define INST_JUMP_ABS(OP) \ ((inst_t){.opcode = OP_JUMP_ABS, .operand = DWORD(OP)}) -#define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK}) -#define INST_JUMP_REGISTER ((inst_t){.opcode = OP_JUMP_REGISTER}) +#define INST_JUMP_STACK ((inst_t){.opcode = OP_JUMP_STACK}) +#define INST_JUMP_REGISTER(OP) \ + ((inst_t){.opcode = OP_JUMP_REGISTER, .operand = DWORD(OP)}) #define INST_JUMP_IF(TYPE, OP) \ ((inst_t){.opcode = OP_JUMP_IF_##TYPE, .operand = DWORD(OP)}) -- cgit v1.2.3-13-gbd6f