summaryrefslogtreecommitdiff
path: root/cachedb/cachedb.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2019-06-30 15:01:11 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2019-06-30 15:01:11 +0000
commit366b94c4a9552acfb560d3234aea0955ebc1eb8e (patch)
tree0bee3a4dbb699714374eeab0af43e63f1bf9672d /cachedb/cachedb.c
parent4713c21a1ac91081e50e474d11fcec002b43a562 (diff)
Diffstat (limited to 'cachedb/cachedb.c')
-rw-r--r--cachedb/cachedb.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/cachedb/cachedb.c b/cachedb/cachedb.c
index 5a179a2bb419..08389a4323d4 100644
--- a/cachedb/cachedb.c
+++ b/cachedb/cachedb.c
@@ -72,6 +72,19 @@
# define be64toh(x) OSSwapBigToHostInt64(x)
#endif
+/* Some compilers do not define __BYTE_ORDER__, like IBM XLC on AIX */
+#ifndef be64toh
+#if defined(__sun) || defined(_AIX)
+# if __BIG_ENDIAN__
+# define be64toh(n) (n)
+# define htobe64(n) (n)
+# else
+# define be64toh(n) (((uint64_t)htonl((n) & 0xFFFFFFFF) << 32) | htonl((n) >> 32))
+# define htobe64(n) (((uint64_t)htonl((n) & 0xFFFFFFFF) << 32) | htonl((n) >> 32))
+# endif
+#endif
+#endif /* be64toh */
+
/** the unit test testframe for cachedb, its module state contains
* a cache for a couple queries (in memory). */
struct testframe_moddata {