fix build on hppa and ppc, also submitted upstream

okay brad@, ajacotot@
This commit is contained in:
rfreeman 2012-08-21 00:50:27 +00:00
parent d0600884cd
commit 0c86728cbf

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-build_include_compat_h,v 1.1 2012/08/21 00:50:27 rfreeman Exp $
this is committed upstream as of 2012-08-18, fixes build on hppa, ppc
--- build/include/compat.h.orig Thu Aug 9 04:05:30 2012
+++ build/include/compat.h Thu Aug 9 04:11:36 2012
@@ -140,7 +140,20 @@ static inline float nearbyintf(float x)
# endif
# define B_ENDIAN_C_INLINE 1
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#elif defined(__OpenBSD__)
+# include <machine/endian.h>
+# if _BYTE_ORDER == _LITTLE_ENDIAN
+# define B_LITTLE_ENDIAN 1
+# define B_BIG_ENDIAN 0
+# elif _BYTE_ORDER == _BIG_ENDIAN
+# define B_LITTLE_ENDIAN 0
+# define B_BIG_ENDIAN 1
+# endif
+# define B_SWAP64(x) __swap64(x)
+# define B_SWAP32(x) __swap32(x)
+# define B_SWAP16(x) __swap16(x)
+
+#elif defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define B_LITTLE_ENDIAN 1