From 6668281f17bbee8463e1fa4c97333d5d0b8d08c8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 8 Nov 2015 02:48:12 +0100 Subject: Add non-ARM ASM version of SWAP_DWORD --- src/gfx.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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)) -- cgit v1.2.3