mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-13 07:10:05 +02:00
* bind_utils: bump version * bind_utils: bump version * Deleted bind_utils-9.16.42.patchset * Deleted bind_utils-9.16.42.recipe
73 lines
2.1 KiB
Plaintext
73 lines
2.1 KiB
Plaintext
From c510fc422951babd01004baf8405d90edef6380f Mon Sep 17 00:00:00 2001
|
|
From: Alexander von Gluck IV <kallisti5@unixzen.com>
|
|
Date: Tue, 3 Aug 2021 13:10:12 -0500
|
|
Subject: haiku: patch in our endian code
|
|
|
|
* There's likely better ways to do this with
|
|
_BSD_SOURCE, but I wasn't able to get the standard
|
|
methods working
|
|
|
|
diff --git a/lib/isc/include/isc/endian.h b/lib/isc/include/isc/endian.h
|
|
index e598a7b..da52c32 100644
|
|
--- a/lib/isc/include/isc/endian.h
|
|
+++ b/lib/isc/include/isc/endian.h
|
|
@@ -13,7 +13,54 @@
|
|
|
|
#pragma once
|
|
|
|
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
|
|
+#if defined(__HAIKU__)
|
|
+
|
|
+#include <config/HaikuConfig.h>
|
|
+#include <support/ByteOrder.h>
|
|
+#include <support/SupportDefs.h>
|
|
+
|
|
+/*
|
|
+ * General byte order swapping functions.
|
|
+ */
|
|
+#define bswap16(x) __swap_int16(x)
|
|
+#define bswap32(x) __swap_int32(x)
|
|
+#define bswap64(x) __swap_int64(x)
|
|
+
|
|
+/*
|
|
+ * Host to big endian, host to little endian, big endian to host, and little
|
|
+ * endian to host byte order functions as detailed in byteorder(9).
|
|
+ */
|
|
+#if BYTE_ORDER == LITTLE_ENDIAN
|
|
+#define htobe16(x) bswap16((x))
|
|
+#define htobe32(x) bswap32((x))
|
|
+#define htobe64(x) bswap64((x))
|
|
+#define htole16(x) ((uint16_t)(x))
|
|
+#define htole32(x) ((uint32_t)(x))
|
|
+#define htole64(x) ((uint64_t)(x))
|
|
+
|
|
+#define be16toh(x) bswap16((x))
|
|
+#define be32toh(x) bswap32((x))
|
|
+#define be64toh(x) bswap64((x))
|
|
+#define le16toh(x) ((uint16_t)(x))
|
|
+#define le32toh(x) ((uint32_t)(x))
|
|
+#define le64toh(x) ((uint64_t)(x))
|
|
+#else /* BYTE_ORDER != LITTLE_ENDIAN */
|
|
+#define htobe16(x) ((uint16_t)(x))
|
|
+#define htobe32(x) ((uint32_t)(x))
|
|
+#define htobe64(x) ((uint64_t)(x))
|
|
+#define htole16(x) bswap16((x))
|
|
+#define htole32(x) bswap32((x))
|
|
+#define htole64(x) bswap64((x))
|
|
+
|
|
+#define be16toh(x) ((uint16_t)(x))
|
|
+#define be32toh(x) ((uint32_t)(x))
|
|
+#define be64toh(x) ((uint64_t)(x))
|
|
+#define le16toh(x) bswap16((x))
|
|
+#define le32toh(x) bswap32((x))
|
|
+#define le64toh(x) bswap64((x))
|
|
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
|
|
+
|
|
+#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
|
|
defined(__OpenBSD__) || defined(__bsdi__)
|
|
|
|
#include <sys/endian.h>
|
|
--
|
|
2.37.3
|
|
|