From a4583fdafc993ea4f0d7218dbcfda862ea79fd7e Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 14 Sep 2002 19:52:49 +0000 Subject: [PATCH] Fix to work correctly under linux llvm-svn: 3720 --- llvm/include/Support/DataTypes.h | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/llvm/include/Support/DataTypes.h b/llvm/include/Support/DataTypes.h index 473b5b9f38c4..3d377bebe69d 100644 --- a/llvm/include/Support/DataTypes.h +++ b/llvm/include/Support/DataTypes.h @@ -23,20 +23,29 @@ #include #ifdef __linux__ -# include +# include +# if BYTE_ORDER == LITTLE_ENDIAN +# undef BIG_ENDIAN +# else +# undef LITTLE_ENDIAN +# endif #else -#if (BSD >= 199103) -# include -#endif +# if (BSD >= 199103) +# include +# endif #endif #ifdef __sparc__ -#include -#ifdef _LITTLE_ENDIAN -#define LITTLE_ENDIAN 1 -#else -#define BIG_ENDIAN 1 +# include +# 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)