aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorKung Hsu <kung@cygnus>1995-03-01 02:13:06 +0000
committerKung Hsu <kung@cygnus>1995-03-01 02:13:06 +0000
commit66aa7cf935634f615e1134f708c3d5aa95b3e5bc (patch)
treec3107773f7628d62d9f249c5c8000b4d9d749911 /gdb/defs.h
parentabed6bc2e16f4253cfe464db18a2aefcda871a80 (diff)
downloadgdb-66aa7cf935634f615e1134f708c3d5aa95b3e5bc.zip
gdb-66aa7cf935634f615e1134f708c3d5aa95b3e5bc.tar.gz
gdb-66aa7cf935634f615e1134f708c3d5aa95b3e5bc.tar.bz2
* defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not
compile time.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 5f09ba7..884d5ad 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -741,22 +741,23 @@ extern void set_endian_from_file PARAMS ((bfd *));
#endif /* BITS_BIG_ENDIAN not defined. */
/* Swap LEN bytes at BUFFER between target and host byte-order. */
-#if TARGET_BYTE_ORDER == HOST_BYTE_ORDER
-#define SWAP_TARGET_AND_HOST(buffer,len)
-#else /* Target and host byte order differ. */
#define SWAP_TARGET_AND_HOST(buffer,len) \
- { \
- char __tmp_; \
- char *p = (char *)(buffer); \
- char *q = ((char *)(buffer)) + len - 1; \
- for (; p < q; p++, q--) \
- { \
- __tmp_ = *q; \
- *q = *p; \
- *p = __tmp_; \
- } \
- }
-#endif /* Target and host byte order differ. */
+ do \
+ { \
+ if (TARGET_BYTE_ORDER != HOST_BYTE_ORDER) \
+ { \
+ char tmp; \
+ char *p = (char *)(buffer); \
+ char *q = ((char *)(buffer)) + len - 1; \
+ for (; p < q; p++, q--) \
+ { \
+ tmp = *q; \
+ *q = *p; \
+ *p = tmp; \
+ } \
+ } \
+ } \
+ while (0)
/* In findvar.c. */