summaryrefslogtreecommitdiff
path: root/src/gfx.h
diff options
context:
space:
mode:
authortwinaphex2015-11-08 02:48:12 +0100
committertwinaphex2015-11-08 02:48:12 +0100
commit6668281f17bbee8463e1fa4c97333d5d0b8d08c8 (patch)
tree902bed544bb0feebc90d78644d3f91e35d7a234f /src/gfx.h
parentee44145406cbe2c1a77772c02683ed3f578c737d (diff)
downloadsnes9x2002-6668281f17bbee8463e1fa4c97333d5d0b8d08c8.tar.gz
snes9x2002-6668281f17bbee8463e1fa4c97333d5d0b8d08c8.tar.bz2
snes9x2002-6668281f17bbee8463e1fa4c97333d5d0b8d08c8.zip
Add non-ARM ASM version of SWAP_DWORD
Diffstat (limited to 'src/gfx.h')
-rw-r--r--src/gfx.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gfx.h b/src/gfx.h
index 55f5a56..ce94a3c 100644
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -157,6 +157,7 @@ extern uint8 mul_brightness [16][32];
//#define SWAP_DWORD(dw) dw = ((dw & 0xff) << 24) | ((dw & 0xff00) << 8) | \
// ((dw & 0xff0000) >> 8) | ((dw & 0xff000000) >> 24)
// by Harald Kipp, from http://www.ethernut.de/en/documents/arm-inline-asm.html
+#ifdef ARM_ASM
#define SWAP_DWORD(val) \
__asm__ __volatile__ ( \
"eor r3, %1, %1, ror #16\n\t" \
@@ -167,7 +168,12 @@ extern uint8 mul_brightness [16][32];
: "0"(val) \
: "r3", "cc" \
);
-
+#else
+#define SWAP_DWORD(dword) ((((unsigned int)(dword) & 0x000000ff) << 24) \
+ | (((unsigned int)(dword) & 0x0000ff00) << 8) \
+ | (((unsigned int)(dword) & 0x00ff0000) >> 8) \
+ | (((unsigned int)(dword) & 0xff000000) >> 24))
+#endif
#ifdef FAST_LSB_WORD_ACCESS
#define READ_2BYTES(s) (*(uint16 *) (s))