aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 05:43:57 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-15 05:44:06 +0100
commit3786b7d785f6c99faef13374c23c4ccff660e119 (patch)
treea94f9a29690f184dc3e825f92d066f866b92b2c0 /src
parent4ddc3cce715b69e52b618db37c362ee3e05d2287 (diff)
downloadovm-3786b7d785f6c99faef13374c23c4ccff660e119.tar.gz
ovm-3786b7d785f6c99faef13374c23c4ccff660e119.tar.bz2
ovm-3786b7d785f6c99faef13374c23c4ccff660e119.zip
stack.size -> stack.max
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 432d74f..db914ad 100644
--- a/src/main.c
+++ b/src/main.c
@@ -20,20 +20,20 @@ typedef struct
struct Stack
{
byte *data;
- word ptr, size;
+ word ptr, max;
} stack;
} vm_t;
void vm_load_stack(vm_t *vm, byte *bytes, size_t size)
{
vm->stack.data = bytes;
- vm->stack.size = size;
+ vm->stack.max = size;
vm->stack.ptr = 0;
}
void vm_push_byte(vm_t *vm, data_t b)
{
- if (vm->stack.ptr >= vm->stack.size)
+ if (vm->stack.ptr >= vm->stack.max)
// TODO: Error STACK_OVERFLOW
return;
vm->stack.data[vm->stack.ptr++] = b.as_byte;
@@ -41,7 +41,7 @@ void vm_push_byte(vm_t *vm, data_t b)
void vm_push_word(vm_t *vm, data_t w)
{
- if (vm->stack.ptr + WORD_SIZE >= vm->stack.size)
+ if (vm->stack.ptr + WORD_SIZE >= vm->stack.max)
// TODO: Error STACK_OVERFLOW
return;
// By default store in big endian
@@ -56,7 +56,7 @@ void vm_push_word(vm_t *vm, data_t w)
void vm_push_float(vm_t *vm, data_t f)
{
- if (vm->stack.ptr + FLOAT_SIZE >= vm->stack.size)
+ if (vm->stack.ptr + FLOAT_SIZE >= vm->stack.max)
// TODO: Error STACK_OVERFLOW
return;
// TODO: Make this machine independent (encode IEEE754 floats