From 848c2f75e31ac7373dbb7b232911b8c15728dd20 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Wed, 1 Nov 2023 18:10:43 +0000 Subject: 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. --- vm/runtime.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'vm/runtime.h') 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 -- cgit v1.2.3-13-gbd6f