diff options
author | Eric Christopher <echristo@apple.com> | 2012-09-20 06:19:20 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2012-09-20 06:19:20 +0000 |
commit | 47a953e75f0dd4ce91da5c6bb0e87490727a59e6 (patch) | |
tree | b88a38bfe1489da39fc1c1592793f7e6d0dc107e | |
parent | 1c2a24e131a8f15a70586a0563afe7a6e4a68aa7 (diff) | |
download | compiler-rt-47a953e75f0dd4ce91da5c6bb0e87490727a59e6.tar.gz compiler-rt-47a953e75f0dd4ce91da5c6bb0e87490727a59e6.tar.bz2 compiler-rt-47a953e75f0dd4ce91da5c6bb0e87490727a59e6.tar.xz |
Both OpenBSD and Bitrig need to include machine/endian.h to get the
_BYTE_ORDER define.
Patch by David Hill.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@164286 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/int_endianness.h | 15 | ||||
-rw-r--r-- | test/Unit/endianness.h | 15 |
2 files changed, 29 insertions, 1 deletions
diff --git a/lib/int_endianness.h b/lib/int_endianness.h index 70bd1773..edb58c81 100644 --- a/lib/int_endianness.h +++ b/lib/int_endianness.h @@ -31,7 +31,7 @@ /* .. */ -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__minix) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__minix) #include <sys/endian.h> #if _BYTE_ORDER == _BIG_ENDIAN @@ -44,6 +44,19 @@ #endif /* *BSD */ +#if defined(__OpenBSD__) || defined(__Bitrig__) +#include <machine/endian.h> + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* OpenBSD and Bitrig. */ + /* .. */ /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ diff --git a/test/Unit/endianness.h b/test/Unit/endianness.h index 669e6f17..06c53de0 100644 --- a/test/Unit/endianness.h +++ b/test/Unit/endianness.h @@ -51,6 +51,21 @@ /* .. */ +#if defined(__OpenBSD__) || defined(__Bitrig__) +#include <machine/endian.h> + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* OpenBSD and Bitrig. */ + +/* .. */ + /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ #if defined(__APPLE__) && defined(__MACH__) || defined(__ellcc__ ) |