27 lines
1.1 KiB
Plaintext
27 lines
1.1 KiB
Plaintext
$OpenBSD: patch-src_bswap_h,v 1.2 2013/06/07 10:03:27 benoit Exp $
|
|
--- src/bswap.h.orig Tue Jun 4 09:42:47 2013
|
|
+++ src/bswap.h Fri Jun 7 11:01:28 2013
|
|
@@ -39,6 +39,7 @@
|
|
# include <libkern/OSByteOrder.h>
|
|
# define __bswap_16(x) OSSwapInt16(x)
|
|
# define __bswap_32(x) OSSwapInt32(x)
|
|
+# define __bswap_64(x) OSSwapInt64(x)
|
|
#elif HAVE_BYTESWAP_H
|
|
# include <byteswap.h>
|
|
#else
|
|
@@ -48,5 +49,14 @@
|
|
(((uint32_t)(x) & 0x00ff0000) >> 8) | \
|
|
(((uint32_t)(x) & 0x0000ff00) << 8) | \
|
|
(((uint32_t)(x) & 0x000000ff) << 24)))
|
|
+# define __bswap_64(x) \
|
|
+ ((uint64_t)((((uint64_t)(x) & 0xff00000000000000ULL) >> 56) | \
|
|
+ (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
|
|
+ (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | \
|
|
+ (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
|
|
+ (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | \
|
|
+ (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
|
|
+ (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | \
|
|
+ (((uint64_t)(x) & 0x00000000000000ffULL) << 56)))
|
|
#endif
|
|
#endif
|