From: Kung Hsu Date: Wed, 1 Mar 1995 02:13:06 +0000 (+0000) Subject: * defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66aa7cf935634f615e1134f708c3d5aa95b3e5bc;p=binutils-gdb.git * defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not compile time. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 33bcbe3aa08..b6096eefda1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ Tue Feb 28 14:38:39 1995 Kung Hsu + * defs.h (SWAP_TARGET_AND_HOST): check endianess at runtime not + compile time. + * arc-tdep.c (_initialize_arc_tdep): set tm_print_insn according to processor. * remote-arc.c (arc_wait): when a processor stops, stop other two diff --git a/gdb/defs.h b/gdb/defs.h index 5f09ba7c841..884d5ad248f 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. */