From 1fa5d4bdfcc6fea44f9abf353d25f3a5d013f5d7 Mon Sep 17 00:00:00 2001 From: Satadru Pramanik Date: Tue, 21 Jun 2022 20:44:30 +0000 Subject: Add support for building on macOS w/o X11, using endian code from "portable_endian.h"... --- src/common_interface.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/common_interface.c b/src/common_interface.c index cb95e90..a4439b6 100644 --- a/src/common_interface.c +++ b/src/common_interface.c @@ -70,6 +70,24 @@ # define HTOLE_32(x) (x) #endif /* Solaris */ +#elif defined(__APPLE__) +#include + +#define htobe16(x) OSSwapHostToBigInt16(x) +#define htole16(x) OSSwapHostToLittleInt16(x) +#define be16toh(x) OSSwapBigToHostInt16(x) +#define le16toh(x) OSSwapLittleToHostInt16(x) + +#define htobe32(x) OSSwapHostToBigInt32(x) +#define htole32(x) OSSwapHostToLittleInt32(x) +#define be32toh(x) OSSwapBigToHostInt32(x) +#define le32toh(x) OSSwapLittleToHostInt32(x) + +#define htobe64(x) OSSwapHostToBigInt64(x) +#define htole64(x) OSSwapHostToLittleInt64(x) +#define be64toh(x) OSSwapBigToHostInt64(x) +#define le64toh(x) OSSwapLittleToHostInt64(x) + #else #include -- cgit v1.2.1