aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:05:25 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:05:25 +0000
commit14a3820e7406aa403aab67254f91886d30244b82 (patch)
tree26164acc13b4f890108cddc3ed029be42980672a
parent036d3dcfba08e716356bb24ea2b11908c06f373a (diff)
downloadovm-14a3820e7406aa403aab67254f91886d30244b82.tar.gz
ovm-14a3820e7406aa403aab67254f91886d30244b82.tar.bz2
ovm-14a3820e7406aa403aab67254f91886d30244b82.zip
Implemented new types of EQ, forced all comparators to push bytes
Just need to call their unsigned versions. All comparators should push bytes as it makes return types uniform.
-rw-r--r--vm/runtime.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/vm/runtime.c b/vm/runtime.c
index d188b29..82886b8 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -725,8 +725,7 @@ err_t vm_eq_byte(vm_t *vm)
err_t vm_eq_char(vm_t *vm)
{
- (void)vm;
- return ERR_END_OF_PROGRAM;
+ return vm_eq_byte(vm);
}
err_t vm_eq_hword(vm_t *vm)
@@ -738,19 +737,17 @@ err_t vm_eq_hword(vm_t *vm)
err = vm_pop_hword(vm, &b);
if (err)
return err;
- return vm_push_hword(vm, DHWORD(a.as_hword == b.as_hword));
+ return vm_push_byte(vm, DBYTE(a.as_hword == b.as_hword));
}
err_t vm_eq_int(vm_t *vm)
{
- (void)vm;
- return ERR_END_OF_PROGRAM;
+ return vm_eq_hword(vm);
}
err_t vm_eq_long(vm_t *vm)
{
- (void)vm;
- return ERR_END_OF_PROGRAM;
+ return vm_eq_word(vm);
}
err_t vm_eq_word(vm_t *vm)
@@ -762,7 +759,7 @@ err_t vm_eq_word(vm_t *vm)
err = vm_pop_word(vm, &b);
if (err)
return err;
- return vm_push_word(vm, DWORD(a.as_word == b.as_word));
+ return vm_push_byte(vm, DBYTE(a.as_word == b.as_word));
}
err_t vm_lt_byte(vm_t *vm)