Refactor type byte -> byte_t

Simpler to read as a type.  This style will allow me to define signed
versions of the base types as simpler names than what they are
currently.
This commit is contained in:
2024-04-25 10:48:51 +05:30
parent 159501168c
commit 1dfdbb3cd0
10 changed files with 39 additions and 38 deletions

View File

@@ -417,7 +417,8 @@ inst_t *insts_read_bytecode(darr_t *bytes, size_t *ret_size)
while (bytes->used < bytes->available)
{
inst_t instruction = inst_read_bytecode(bytes);
darr_append_bytes(&instructions, (byte *)&instruction, sizeof(instruction));
darr_append_bytes(&instructions, (byte_t *)&instruction,
sizeof(instruction));
}
*ret_size = instructions.used / sizeof(inst_t);
return (inst_t *)instructions.data;
@@ -446,9 +447,9 @@ void prog_write_bytecode(prog_t *program, darr_t *buffer)
{
// Write program header i.e. the start and count
word start = word_htobc(program->start_address);
darr_append_bytes(buffer, (byte *)&start, sizeof(start));
darr_append_bytes(buffer, (byte_t *)&start, sizeof(start));
word count = word_htobc(program->count);
darr_append_bytes(buffer, (byte *)&count, sizeof(count));
darr_append_bytes(buffer, (byte_t *)&count, sizeof(count));
// Write instructions
insts_write_bytecode(program->instructions, program->count, buffer);