summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorDavid Michael <fedora.dm0@gmail.com>2014-10-26 17:34:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-27 18:51:12 (GMT)
commitbfb0e6fcd2826a869383b766712131a07a8059b0 (patch)
tree9bba2bf131e39a07b174e487eb290266eb09fc93 /compat
parent48a031af3cc555e0eb9d30b96f2e0943de7c44ae (diff)
downloadgit-bfb0e6fcd2826a869383b766712131a07a8059b0.zip
git-bfb0e6fcd2826a869383b766712131a07a8059b0.tar.gz
git-bfb0e6fcd2826a869383b766712131a07a8059b0.tar.bz2
compat/bswap.h: detect endianness from XL C compiler macros
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/bswap.h4
1 files changed, 4 insertions, 0 deletions
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