From 580e407b05da10fa82586cacf07796b2ff58c123 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 16 Jan 2023 09:40:32 +0000 Subject: [PATCH] Squeaky clean! --- source/compiler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/compiler.c b/source/compiler.c index 7e1b2ec..63afcc6 100644 --- a/source/compiler.c +++ b/source/compiler.c @@ -241,7 +241,7 @@ static int writeLiteralToCompiler(Compiler* compiler, Literal literal) { if (index >= 256) { //push a "long" index compiler->bytecode[compiler->count++] = OP_LITERAL_LONG; //1 byte - *((unsigned short*)(compiler->bytecode + compiler->count)) = (unsigned short)index; //2 bytes + memcpy(compiler->bytecode + compiler->count, &index, sizeof(unsigned short)); //2 bytes compiler->count += sizeof(unsigned short); } @@ -405,7 +405,7 @@ static Opcode writeCompilerWithJumps(Compiler* compiler, ASTNode* node, void* br if (index >= 256) { //push a "long" index compiler->bytecode[compiler->count++] = OP_LITERAL_LONG; //1 byte - *((unsigned short*)(compiler->bytecode + compiler->count)) = (unsigned short)index; //2 bytes + memcpy(compiler->bytecode + compiler->count, &index, sizeof(unsigned short)); compiler->count += sizeof(unsigned short); }