summaryrefslogtreecommitdiff
path: root/common.h
diff options
context:
space:
mode:
authorneonloop2021-07-03 19:54:16 +0000
committerneonloop2021-07-03 19:54:16 +0000
commit2815c248d76932787fb58d5bbaa0f26be7bcb2be (patch)
treeeff2b1e2c458fcd0b5f96902382df944048d36b7 /common.h
parent8dec6231614ba3f47d874d551ab83f4c5acb07cb (diff)
parent3d874ec5e3d5675ae9513264d857a3c6c9d2417c (diff)
downloadpicogpsp-2815c248d76932787fb58d5bbaa0f26be7bcb2be.tar.gz
picogpsp-2815c248d76932787fb58d5bbaa0f26be7bcb2be.tar.bz2
picogpsp-2815c248d76932787fb58d5bbaa0f26be7bcb2be.zip
Merge remote-tracking branch 'libretro/master' into pico-fe
Diffstat (limited to 'common.h')
-rw-r--r--common.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/common.h b/common.h
index 9317849..714d607 100644
--- a/common.h
+++ b/common.h
@@ -128,6 +128,22 @@ typedef u32 fixed8_24;
#define address32(base, offset) \
*((u32 *)((u8 *)base + (offset))) \
+#define eswap8(value) (value)
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+ #define eswap16(value) __builtin_bswap16(value)
+ #define eswap32(value) __builtin_bswap32(value)
+#else
+ #define eswap16(value) (value)
+ #define eswap32(value) (value)
+#endif
+
+#define readaddress8(base, offset) eswap8( address8( base, offset))
+#define readaddress16(base, offset) eswap16(address16(base, offset))
+#define readaddress32(base, offset) eswap32(address32(base, offset))
+
+#define read_ioreg(regnum) (eswap16(io_registers[(regnum)]))
+#define write_ioreg(regnum, val) io_registers[(regnum)] = eswap16(val)
+
#include <unistd.h>
#include <time.h>
#include <stdlib.h>