File zdbsp-bigendian.diff of Package zdbsp
From: Jan Engelhardt <jengelh@inai.de>
Date: 2013-03-23 14:09:45.355761386 +0100
zdbsp: resolve compile failure on big-endian
__BIG_ENDIAN__ is not set in bare g++ (without extra headers).
---
zdbsp.h | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
Index: zdbsp-1.18.1/zdbsp.h
===================================================================
--- zdbsp-1.18.1.orig/zdbsp.h
+++ zdbsp-1.18.1/zdbsp.h
@@ -237,15 +237,12 @@ inline fixed_t DMulScale32 (fixed_t a, f
#define LittleShort(x) CFSwapInt16LittleToHost(x)
#define LittleLong(x) CFSwapInt32LittleToHost(x)
#else
-#ifdef __BIG_ENDIAN__
+#if defined(__BIG_ENDIAN__) || \
+ (defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
+ (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__))
// Swap 16bit, that is, MSB and LSB byte.
// No masking with 0xFF should be necessary.
-inline short LittleShort (short x)
-{
- return (short)((((unsigned short)x)>>8) | (((unsigned short)x)<<8));
-}
-
inline unsigned short LittleShort (unsigned short x)
{
return (unsigned short)((x>>8) | (x<<8));
@@ -261,15 +258,6 @@ inline unsigned int LittleLong (unsigned
| (x<<24));
}
-inline int LittleLong (int x)
-{
- return (int)(
- (((unsigned int)x)>>24)
- | ((((unsigned int)x)>>8) & 0xff00)
- | ((((unsigned int)x)<<8) & 0xff0000)
- | (((unsigned int)x)<<24));
-}
-
#else
#define LittleShort(x) (x)