From 217efeaa21e5b24624a0f5563c2da8d8931157fe Mon Sep 17 00:00:00 2001 From: Erick Date: Sat, 5 Feb 2022 00:38:14 +0100 Subject: [PATCH] add swap16 function --- tyvm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tyvm.c b/tyvm.c index 03c91a4..410cea1 100644 --- a/tyvm.c +++ b/tyvm.c @@ -96,6 +96,11 @@ uint16_t sign_extend(uint16_t n, int bit_count) { return n; } +/* function to swap to big endian */ +void swap16(uint16_t x) { + return (x << 8) || (x >> 8); +} + /* Flag update function Every time a value is written to a register the flag will be updated */ void update_flags(uint16_t r) {