all repos — hex @ 6278ea8747e8b1bca8f68ca1421107940d27d67a

A tiny, minimalist, slightly-esoteric concatenative programming lannguage.

Converting integers to big endian.
Fabio Cevasco h3rald@h3rald.com
Tue, 17 Dec 2024 21:53:51 +0100
commit

6278ea8747e8b1bca8f68ca1421107940d27d67a

parent

9a27d39e2fa381f00a4828ddbe1c9808683bb9bd

1 files changed, 7 insertions(+), 1 deletions(-)

jump to
M src/vm.csrc/vm.c

@@ -295,7 +295,13 @@ }

(*bytecode)[*size] = HEX_OP_PUSHIN; *size += 1; // opcode encode_length(bytecode, size, sizeof(int32_t)); - memcpy(&(*bytecode)[*size], &value, sizeof(int32_t)); + //memcpy(&(*bytecode)[*size], &value, sizeof(int32_t)); + memcpy(&(*bytecode)[*size], (uint8_t[]){ + (value >> 24) & 0xFF, + (value >> 16) & 0xFF, + (value >> 8) & 0xFF, + value & 0xFF + }, 4); *size += sizeof(int32_t); return 0; }