diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 20:27:09 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2023-10-22 20:28:10 +0100 |
commit | aa3d1cb85f7940738468db37211c6841d90e6d4b (patch) | |
tree | 23d450fe342e43be24f6b6a25c45d67a929892cc /src/runtime.c | |
parent | b20ad511a0a375da9dd92542e58a4a2cd0721d9f (diff) | |
download | ovm-aa3d1cb85f7940738468db37211c6841d90e6d4b.tar.gz ovm-aa3d1cb85f7940738468db37211c6841d90e6d4b.tar.bz2 ovm-aa3d1cb85f7940738468db37211c6841d90e6d4b.zip |
Added NUMBER_OF_OPCODES which aids in compilation errors
If I add a new operand I want the build system to be more helpful in
finding the places I need to change to make it work.
Diffstat (limited to 'src/runtime.c')
-rw-r--r-- | src/runtime.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/runtime.c b/src/runtime.c index 67ea779..5c9b985 100644 --- a/src/runtime.c +++ b/src/runtime.c @@ -10,6 +10,7 @@ * Description: Virtual machine implementation */ +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -18,6 +19,7 @@ void vm_execute(vm_t *vm) { + static_assert(NUMBER_OF_OPCODES == 31, "vm_execute: Out of date"); struct Program *prog = &vm->program; if (prog->ptr >= prog->max) // TODO: Error (Went past end of program) |