aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2024-04-09 21:23:30 +0630
committerAryadev Chavali <aryadev@aryadevchavali.com>2024-04-09 21:23:30 +0630
commit33e1d2ab72457dcba1aa2708554705fb31de4ba3 (patch)
tree394d8a69bf1ccceda12388e40c790a040fa9ebfa
parentd256e06f518d701413dfb9bff6d00504f8c88109 (diff)
downloadovm-33e1d2ab72457dcba1aa2708554705fb31de4ba3.tar.gz
ovm-33e1d2ab72457dcba1aa2708554705fb31de4ba3.tar.bz2
ovm-33e1d2ab72457dcba1aa2708554705fb31de4ba3.zip
Added some TODOs to lib/inst.c to enforce endian
-rw-r--r--lib/inst.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/inst.c b/lib/inst.c
index 64fbcab..eb8b5d2 100644
--- a/lib/inst.c
+++ b/lib/inst.c
@@ -326,9 +326,11 @@ void inst_write_bytecode(inst_t inst, darr_t *darr)
darr_append_byte(darr, inst.operand.as_byte);
break;
case DATA_TYPE_HWORD:
+ // TODO: Enforce endian here
darr_append_bytes(darr, (byte *)&inst.operand.as_hword, HWORD_SIZE);
break;
case DATA_TYPE_WORD:
+ // TODO: Enforce endian here
darr_append_bytes(darr, (byte *)&inst.operand.as_word, WORD_SIZE);
break;
}
@@ -353,6 +355,7 @@ data_t read_type_from_darr(darr_t *darr, data_type_t type)
return DBYTE(darr->data[darr->used++]);
break;
case DATA_TYPE_HWORD:
+ // TODO: Enforce endian here
if (darr->used + HWORD_SIZE > darr->available)
// TODO: Error (darr has no space left)
return DWORD(0);
@@ -362,6 +365,7 @@ data_t read_type_from_darr(darr_t *darr, data_type_t type)
return DHWORD(u);
break;
case DATA_TYPE_WORD:
+ // TODO: Enforce endian here
if (darr->used + WORD_SIZE > darr->available)
// TODO: Error (darr has no space left)
return DWORD(0);