summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2018-04-30 22:55:17 +0200
committerMichael Lutz <michi@icosahedron.de>2018-04-30 23:57:28 +0200
commit9959cd9522c939d83744c1eac97582c842ed9907 (patch)
tree15aa62e3cb72ff49e71b7881c57cbdea444bcd68 /src
parentbb5584c835a40e287ea7d307f83506e266ccb01a (diff)
downloadopenttd-9959cd9522c939d83744c1eac97582c842ed9907.tar.xz
Fix 0165fe1: Native OSX doesn't have a __BYTE_ORDER macro but defines a differently named macro.
Diffstat (limited to 'src')
-rw-r--r--src/core/endian_type.hpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/core/endian_type.hpp b/src/core/endian_type.hpp
index cb3e348b4..453bf5402 100644
--- a/src/core/endian_type.hpp
+++ b/src/core/endian_type.hpp
@@ -27,14 +27,21 @@
/* Windows has always LITTLE_ENDIAN */
#if defined(WIN32) || defined(__OS2__) || defined(WIN64)
- #define TTD_ENDIAN TTD_LITTLE_ENDIAN
+# define TTD_ENDIAN TTD_LITTLE_ENDIAN
+#elif defined(OSX)
+# include <sys/types.h>
+# if __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN
+# define TTD_ENDIAN TTD_LITTLE_ENDIAN
+# else
+# define TTD_ENDIAN TTD_BIG_ENDIAN
+# endif
#elif !defined(TESTING)
- #include <sys/param.h>
- #if __BYTE_ORDER == __LITTLE_ENDIAN
- #define TTD_ENDIAN TTD_LITTLE_ENDIAN
- #else
- #define TTD_ENDIAN TTD_BIG_ENDIAN
- #endif
+# include <sys/param.h>
+# if __BYTE_ORDER == __LITTLE_ENDIAN
+# define TTD_ENDIAN TTD_LITTLE_ENDIAN
+# else
+# define TTD_ENDIAN TTD_BIG_ENDIAN
+# endif
#endif /* WIN32 || __OS2__ || WIN64 */
#endif /* ENDIAN_TYPE_HPP */