Skip to content

Commit bfb0e6f

Browse files
dm0-gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48a031a commit bfb0e6f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compat/bswap.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ static inline uint64_t git_bswap64(uint64_t x)
122122
# define GIT_BYTE_ORDER GIT_BIG_ENDIAN
123123
# elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
124124
# define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
125+
# elif defined(__THW_BIG_ENDIAN__) && !defined(__THW_LITTLE_ENDIAN__)
126+
# define GIT_BYTE_ORDER GIT_BIG_ENDIAN
127+
# elif defined(__THW_LITTLE_ENDIAN__) && !defined(__THW_BIG_ENDIAN__)
128+
# define GIT_BYTE_ORDER GIT_LITTLE_ENDIAN
125129
# else
126130
# error "Cannot determine endianness"
127131
# endif

0 commit comments

Comments
 (0)