From 679888feb49c8a2e453a0fe4aeb50b439903ec95 Mon Sep 17 00:00:00 2001 From: Björn Stenberg Date: Sun, 21 Apr 2002 22:25:17 +0000 Subject: Replaced SWAB macros with register-safe versions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@165 a1c6a512-1295-4272-9138-f99709370657 --- firmware/system.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'firmware/system.h') diff --git a/firmware/system.h b/firmware/system.h index 8ffc7547b7..342b60cba0 100644 --- a/firmware/system.h +++ b/firmware/system.h @@ -38,14 +38,20 @@ #define SWAB32(x) (x) #else #define SWAB16(x) \ - (((x & 0x00ff) << 8) | \ - ((x & 0xff00) >> 8)) +({ \ + unsigned short __x = x; \ + (((__x & 0x00ff) << 8) | \ + ((__x & 0xff00) >> 8)); \ +}) #define SWAB32(x) \ - (((x & 0x000000ff) << 24) | \ - ((x & 0x0000ff00) << 8) | \ - ((x & 0x00ff0000) >> 8) | \ - ((x & 0xff000000) >> 24)) +({ \ + unsigned long __x = x; \ + (((__x & 0x000000ff) << 24) | \ + ((__x & 0x0000ff00) << 8) | \ + ((__x & 0x00ff0000) >> 8) | \ + ((__x & 0xff000000) >> 24)); \ +}) #endif #define nop \ -- cgit v1.2.3