From 47a953e75f0dd4ce91da5c6bb0e87490727a59e6 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 20 Sep 2012 06:19:20 +0000 Subject: 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 --- test/Unit/endianness.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') 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 + +#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__ ) -- cgit v1.2.3