diff options
-rw-r--r-- | firmware/system.h | 18 |
1 files changed, 12 insertions, 6 deletions
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 @@ | |||
38 | #define SWAB32(x) (x) | 38 | #define SWAB32(x) (x) |
39 | #else | 39 | #else |
40 | #define SWAB16(x) \ | 40 | #define SWAB16(x) \ |
41 | (((x & 0x00ff) << 8) | \ | 41 | ({ \ |
42 | ((x & 0xff00) >> 8)) | 42 | unsigned short __x = x; \ |
43 | (((__x & 0x00ff) << 8) | \ | ||
44 | ((__x & 0xff00) >> 8)); \ | ||
45 | }) | ||
43 | 46 | ||
44 | #define SWAB32(x) \ | 47 | #define SWAB32(x) \ |
45 | (((x & 0x000000ff) << 24) | \ | 48 | ({ \ |
46 | ((x & 0x0000ff00) << 8) | \ | 49 | unsigned long __x = x; \ |
47 | ((x & 0x00ff0000) >> 8) | \ | 50 | (((__x & 0x000000ff) << 24) | \ |
48 | ((x & 0xff000000) >> 24)) | 51 | ((__x & 0x0000ff00) << 8) | \ |
52 | ((__x & 0x00ff0000) >> 8) | \ | ||
53 | ((__x & 0xff000000) >> 24)); \ | ||
54 | }) | ||
49 | #endif | 55 | #endif |
50 | 56 | ||
51 | #define nop \ | 57 | #define nop \ |