summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/system.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/firmware/system.h b/firmware/system.h
index 8ffc754..342b60c 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 \