From 37f37b9ae576958fcfbf79561ca2a0203d64285d Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Fri, 17 Aug 2018 13:53:18 +0200 Subject: [PATCH] Add byte swap macros for Xen This fixes compilation to Xen unikernels. --- src/native/endian.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/native/endian.h b/src/native/endian.h index 05ac28f..8495e74 100644 --- a/src/native/endian.h +++ b/src/native/endian.h @@ -21,6 +21,21 @@ #define be64toh(x) OSSwapBigToHostInt64(x) #define le64toh(x) OSSwapLittleToHostInt64(x) +#elif defined(__MINIOS__) + +#include +#include + +#if (BYTE_ORDER == LITTLE_ENDIAN) +#define htobe64(x) (bswap_64(x)) +#define be64toh(x) (bswap_64(x)) +#elif (BYTE_ORDER == BIG_ENDIAN) +#define htobe64(x) (x) +#define be64toh(x) (x) +#else +#error "Cannot determine byte order" +#endif + #else /* Needs _DEFAULT_SOURCE with glibc */