diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-22 12:37:37 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-22 12:37:37 +0200 |
commit | 3b136ffdebf135cc0d285573edd7bdfefb99bb00 (patch) | |
tree | b66f9cf7410c43c6967b69002e0998d87f880f97 /src/bytecode/debug.h | |
parent | 9286c148f601072dded92233a328a8867ff7ab0c (diff) | |
download | bdl-3b136ffdebf135cc0d285573edd7bdfefb99bb00.tar.gz bdl-3b136ffdebf135cc0d285573edd7bdfefb99bb00.zip |
Add unary arithmetic operations for numbers
Diffstat (limited to 'src/bytecode/debug.h')
-rw-r--r-- | src/bytecode/debug.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/bytecode/debug.h b/src/bytecode/debug.h index c891b77..05f9d8e 100644 --- a/src/bytecode/debug.h +++ b/src/bytecode/debug.h | |||
@@ -36,10 +36,6 @@ disassemble_instruction(Chunk *chunk, size_t offset) { | |||
36 | } | 36 | } |
37 | u8 instruction = chunk->code[offset]; | 37 | u8 instruction = chunk->code[offset]; |
38 | switch (instruction) { | 38 | switch (instruction) { |
39 | case OP_RETURN: { | ||
40 | printf("OP_RETURN\n"); | ||
41 | return offset + 1; | ||
42 | } break; | ||
43 | case OP_CONSTANT: { | 39 | case OP_CONSTANT: { |
44 | u8 constant = chunk->code[offset + 1]; | 40 | u8 constant = chunk->code[offset + 1]; |
45 | printf("%-16s %4d (", "OP_CONSTANT", constant); | 41 | printf("%-16s %4d (", "OP_CONSTANT", constant); |
@@ -47,6 +43,12 @@ disassemble_instruction(Chunk *chunk, size_t offset) { | |||
47 | printf(")\n"); | 43 | printf(")\n"); |
48 | return offset + 2; | 44 | return offset + 2; |
49 | } break; | 45 | } break; |
46 | case OP_SUM: { printf("OP_SUM\n"); return offset + 1; } break; | ||
47 | case OP_SUB: { printf("OP_SUB\n"); return offset + 1; } break; | ||
48 | case OP_MUL: { printf("OP_MUL\n"); return offset + 1; } break; | ||
49 | case OP_DIV: { printf("OP_DIV\n"); return offset + 1; } break; | ||
50 | case OP_MOD: { printf("OP_MOD\n"); return offset + 1; } break; | ||
51 | case OP_RETURN: { printf("OP_RETURN\n"); return offset + 1; } break; | ||
50 | default: { | 52 | default: { |
51 | printf("Unknown OP: %d\n", instruction); | 53 | printf("Unknown OP: %d\n", instruction); |
52 | return offset + 1; | 54 | return offset + 1; |