From 3786b7d785f6c99faef13374c23c4ccff660e119 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 15 Oct 2023 05:43:57 +0100 Subject: stack.size -> stack.max --- src/main.c | 10 +++++----- 1 file 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 -- cgit v1.2.3-13-gbd6f