git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] compat/bswap.h: Detect endianness from XL C compiler macros
@ 2014-10-26 17:34 David Michael
  2014-10-26 18:38 ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: David Michael @ 2014-10-26 17:34 UTC (permalink / raw)
  To: git

There is no /usr/include/endian.h equivalent on z/OS, but the
compiler will define macros to indicate endianness on host and
target hardware.  This adds a test for these macros as a last
resort for determining byte order.

Signed-off-by: David Michael <fedora.dm0@gmail.com>
---
 compat/bswap.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/compat/bswap.h b/compat/bswap.h
index f6fd9a6..7fed637 100644
--- a/compat/bswap.h
+++ b/compat/bswap.h
@@ -122,6 +122,10 @@ static inline uint64_t git_bswap64(uint64_t x)
 #  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
 # elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
 #  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
+# elif defined(__THW_BIG_ENDIAN__) && !defined(__THW_LITTLE_ENDIAN__)
+#  define GIT_BYTE_ORDER GIT_BIG_ENDIAN
+# elif defined(__THW_LITTLE_ENDIAN__) && !defined(__THW_BIG_ENDIAN__)
+#  define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
 # else
 #  error "Cannot determine endianness"
 # endif
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-27  5:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-26 17:34 [PATCH 3/3] compat/bswap.h: Detect endianness from XL C compiler macros David Michael
2014-10-26 18:38 ` Jeff King
2014-10-26 20:04   ` David Michael
2014-10-27  5:12     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).