aboutsummaryrefslogtreecommitdiff
path: root/vm
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:41:53 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-10-31 21:41:53 +0000
commit5127202722b2e9f07b4df9be2dc411baa5545290 (patch)
tree925e1f6c4c352c1d4649a81ad1482eab313c6b65 /vm
parent5202dfbb2646cfbfb585f1a00a079438010373e5 (diff)
downloadovm-5127202722b2e9f07b4df9be2dc411baa5545290.tar.gz
ovm-5127202722b2e9f07b4df9be2dc411baa5545290.tar.bz2
ovm-5127202722b2e9f07b4df9be2dc411baa5545290.zip
Introduced 3 new union members to data_t
These new members are just signed versions of the previous members. This makes type punning and usage for signed versions easier than before (no need for memcpy).
Diffstat (limited to 'vm')
-rw-r--r--vm/runtime.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/vm/runtime.c b/vm/runtime.c
index a7d356d..a2e78b7 100644
--- a/vm/runtime.c
+++ b/vm/runtime.c
@@ -188,27 +188,21 @@ err_t vm_execute(vm_t *vm)
switch (print_type)
{
case TYPE_CHAR: {
- char c = 0;
- memcpy(&c, &datum.as_byte, 1);
- printf("%c", c);
+ printf("%c", datum.as_char);
break;
}
case TYPE_BYTE:
printf("0x%x", datum.as_byte);
break;
case TYPE_INT: {
- s_hword i = 0;
- memcpy(&i, &datum.as_hword, HWORD_SIZE);
- printf("%" PRId32, i);
+ printf("%" PRId32, datum.as_int);
break;
}
case TYPE_HWORD:
printf("%" PRIu32, datum.as_hword);
break;
case TYPE_LONG: {
- s_word i = 0;
- memcpy(&i, &datum.as_word, WORD_SIZE);
- printf("%" PRId64, i);
+ printf("%" PRId64, datum.as_long);
break;
}
case TYPE_WORD: