summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@herrb.eu>2022-07-01 12:26:22 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2022-07-01 12:26:22 +0200
commit317fedd1c150d7959a823cbaeddef88dc914d0ff (patch)
tree0afd6b283382478094966a336e89db649d266de2
parente458df41cce8695617872b27823e03047e796b9a (diff)
parent1fa5d4bdfcc6fea44f9abf353d25f3a5d013f5d7 (diff)
Merge remote-tracking branch 'origin/master' into obsd
-rw-r--r--src/common_interface.c18
1 files changed, 18 insertions, 0 deletions
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 <libkern/OSByteOrder.h>
+
+#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 <sys/endian.h>