summaryrefslogtreecommitdiff
path: root/src/helper/types.h
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-06-28 10:32:58 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-06-28 10:32:58 +0000
commit32c6d70f6acd41dd1af5ea73051dd6c8a46eac14 (patch)
tree7e9cf887c56d41c12cc894f95481c7aa85ddb73e /src/helper/types.h
parent8c290412d28f9eef568dac0cfc20ccd4a9eca4d5 (diff)
downloadopenocd+libswd-32c6d70f6acd41dd1af5ea73051dd6c8a46eac14.tar.gz
openocd+libswd-32c6d70f6acd41dd1af5ea73051dd6c8a46eac14.tar.bz2
openocd+libswd-32c6d70f6acd41dd1af5ea73051dd6c8a46eac14.tar.xz
openocd+libswd-32c6d70f6acd41dd1af5ea73051dd6c8a46eac14.zip
- fixed endianness helper macros (thanks to obilix and wiml for finding and fixing this bug)
- added declarations for 32bit fileio access functions (network byte order) - fixed bug in etm trace dump file handling - added XScale trace buffer decoding - fixed arm_simulator ERROR numbers (-7xx used twice) - fixed minor bug in debug output in stellaris.c git-svn-id: svn://svn.berlios.de/openocd/trunk@178 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper/types.h')
-rw-r--r--src/helper/types.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/helper/types.h b/src/helper/types.h
index 69cb16a2..a68c301e 100644
--- a/src/helper/types.h
+++ b/src/helper/types.h
@@ -40,23 +40,23 @@ typedef unsigned long long u64;
#ifdef WORDS_BIGENDIAN /* big endian host */
-#define le_to_h_u32(x) (u32)(x[0] | x[1] << 8 | x[2] << 16 | x[3] << 24)
-#define le_to_h_u16(x) (u16)(x[0] | x[1] << 8)
+#define le_to_h_u32(x) (u32)((x)[0] | (x)[1] << 8 | (x)[2] << 16 | (x)[3] << 24)
+#define le_to_h_u16(x) (u16)((x)[0] | (x)[1] << 8)
#define be_to_h_u32(x) (*(u32*)(x))
#define be_to_h_u16(x) (*(u16*)(x))
#define h_u32_to_le(buf, val) \
do { \
- buf[3] = (val & 0xff000000) >> 24; \
- buf[2] = (val & 0x00ff0000) >> 16; \
- buf[1] = (val & 0x0000ff00) >> 8; \
- buf[0] = (val & 0x000000ff); \
+ (buf)[3] = ((val) & 0xff000000) >> 24; \
+ (buf)[2] = ((val) & 0x00ff0000) >> 16; \
+ (buf)[1] = ((val) & 0x0000ff00) >> 8; \
+ (buf)[0] = ((val) & 0x000000ff); \
} while (0)
#define h_u16_to_le(buf, val) \
do { \
- buf[0] = (val & 0xff000) >> 8; \
- buf[1] = (val & 0x00ff); \
+ (buf)[0] = ((val) & 0xff000) >> 8; \
+ (buf)[1] = ((val) & 0x00ff); \
} while (0)
#define h_u32_to_be(buf, val) do { *(u32*)(buf) = (val); } while (0)
@@ -73,16 +73,16 @@ typedef unsigned long long u64;
#define h_u32_to_be(buf, val) \
do { \
- buf[0] = (val & 0xff000000) >> 24; \
- buf[1] = (val & 0x00ff0000) >> 16; \
- buf[2] = (val & 0x0000ff00) >> 8; \
- buf[3] = (val & 0x000000ff); \
+ (buf)[0] = ((val) & 0xff000000) >> 24; \
+ (buf)[1] = ((val) & 0x00ff0000) >> 16; \
+ (buf)[2] = ((val) & 0x0000ff00) >> 8; \
+ (buf)[3] = ((val) & 0x000000ff); \
} while (0)
#define h_u16_to_be(buf, val) \
do { \
- buf[0] = (val & 0xff000) >> 8; \
- buf[1] = (val & 0x00ff); \
+ (buf)[0] = ((val) & 0xff000) >> 8; \
+ (buf)[1] = ((val) & 0x00ff); \
} while (0)
#endif