openbsd-ports/audio/umurmur/patches/patch-src_byteorder_h
feinerer 43694c8d6d Update to uMurmur 0.2.17
From maintainer Jonathon Sisson, tweaks by sthen@ and me
2019-07-24 12:47:13 +00:00

31 lines
947 B
Plaintext

$OpenBSD: patch-src_byteorder_h,v 1.2 2019/07/24 12:47:13 feinerer Exp $
Include correct userspace header for endian information
Skip linuxism to fix build on LP64 archs that aren't amd64
Index: src/byteorder.h
--- src/byteorder.h.orig
+++ src/byteorder.h
@@ -36,7 +36,7 @@
#include <stdint.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
-#include <machine/endian.h>
+#include <endian.h>
#if BYTE_ORDER == BIG_ENDIAN
#define BYTE_ORDER_BIG_ENDIAN
#endif // BYTE_ORDER == BIG_ENDIAN
@@ -55,9 +55,11 @@ typedef uint64_t subblock;
#define SWAPPED(x) (x)
#elif defined( __x86_64__)
#define SWAPPED(x) ({register uint64_t __out, __in = (x); __asm__("bswap %q0" : "=r"(__out) : "0"(__in)); __out;})
-#else
+#elif defined(LINUX)
#include <byteswap.h>
#define SWAPPED(x) bswap_64(x)
+#else
+#define SWAPPED(x) htobe64(x)
#endif // defined(BYTE_ORDER_BIG_ENDIAN)
#else
#define BLOCKSIZE 4