aboutsummaryrefslogtreecommitdiff
path: root/include/Support/DataTypes.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-09-14 19:52:49 +0000
committerChris Lattner <sabre@nondot.org>2002-09-14 19:52:49 +0000
commit86bdc54d02701184455688fd5196ec1dcd3d81fa (patch)
treeb1887d3e3b262e810dbd7435a4d3b94c6cad8434 /include/Support/DataTypes.h
parentb2a0fbea11e4996a613cb264cff6edbc7626e7e5 (diff)
Fix to work correctly under linux
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3720 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/Support/DataTypes.h')
-rw-r--r--include/Support/DataTypes.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/include/Support/DataTypes.h b/include/Support/DataTypes.h
index 473b5b9f38..3d377bebe6 100644
--- a/include/Support/DataTypes.h
+++ b/include/Support/DataTypes.h
@@ -23,20 +23,29 @@
#include <inttypes.h>
#ifdef __linux__
-# include <endian.h>
+# include <endian.h>
+# if BYTE_ORDER == LITTLE_ENDIAN
+# undef BIG_ENDIAN
+# else
+# undef LITTLE_ENDIAN
+# endif
#else
-#if (BSD >= 199103)
-# include <machine/endian.h>
-#endif
+# if (BSD >= 199103)
+# include <machine/endian.h>
+# endif
#endif
#ifdef __sparc__
-#include <sys/types.h>
-#ifdef _LITTLE_ENDIAN
-#define LITTLE_ENDIAN 1
-#else
-#define BIG_ENDIAN 1
+# include <sys/types.h>
+# ifdef _LITTLE_ENDIAN
+# define LITTLE_ENDIAN 1
+# else
+# define BIG_ENDIAN 1
+# endif
#endif
+
+#if (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN))
+#error "Cannot define both LITTLE_ENDIAN and BIG_ENDIAN!"
#endif
#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) || !defined(INT64_MAX)