aboutsummaryrefslogtreecommitdiff
path: root/vm/runtime.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 18:10:43 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-01 18:10:43 +0000
commit848c2f75e31ac7373dbb7b232911b8c15728dd20 (patch)
tree68c5695a1a9685f7cb2ea66315b83fcf66d1df8a /vm/runtime.h
parent83678ad29a03623d7c13771c0bfa36657b554db4 (diff)
downloadovm-848c2f75e31ac7373dbb7b232911b8c15728dd20.tar.gz
ovm-848c2f75e31ac7373dbb7b232911b8c15728dd20.tar.bz2
ovm-848c2f75e31ac7373dbb7b232911b8c15728dd20.zip
Implement OP_MULT in runtime
Lucky surprise: OP_PLUS follows the same principle rules as the bitwise operators in that they return the same type as the input. Therefore I can simply use the same macro to implement it and MULT as those. Very nice.
Diffstat (limited to 'vm/runtime.h')
-rw-r--r--vm/runtime.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/vm/runtime.h b/vm/runtime.h
index 9dd639e..45d467d 100644
--- a/vm/runtime.h
+++ b/vm/runtime.h
@@ -169,6 +169,10 @@ err_t vm_plus_byte(vm_t *);
err_t vm_plus_hword(vm_t *);
err_t vm_plus_word(vm_t *);
+err_t vm_mult_byte(vm_t *);
+err_t vm_mult_hword(vm_t *);
+err_t vm_mult_word(vm_t *);
+
typedef err_t (*stack_f)(vm_t *);
static const stack_f STACK_ROUTINES[] = {
[OP_NOT_BYTE] = vm_not_byte, [OP_NOT_HWORD] = vm_not_hword,
@@ -204,6 +208,9 @@ static const stack_f STACK_ROUTINES[] = {
[OP_PLUS_BYTE] = vm_plus_byte, [OP_PLUS_HWORD] = vm_plus_hword,
[OP_PLUS_WORD] = vm_plus_word,
+
+ [OP_MULT_BYTE] = vm_mult_byte, [OP_MULT_HWORD] = vm_mult_hword,
+ [OP_MULT_WORD] = vm_mult_word,
};
#endif