git: 44fb3c695f5e - main - endian.h: Use the __bswap* versions
Warner Losh
imp at FreeBSD.org
Tue Sep 21 04:09:03 UTC 2021
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=44fb3c695f5e672ec00bdef0fa0f13793e6269a1
commit 44fb3c695f5e672ec00bdef0fa0f13793e6269a1
Author: Warner Losh <imp at FreeBSD.org>
AuthorDate: 2021-09-21 04:02:35 +0000
Commit: Warner Losh <imp at FreeBSD.org>
CommitDate: 2021-09-21 04:02:35 +0000
endian.h: Use the __bswap* versions
Make it possible to have all these macros work without bswap* being
defined. bswap* is part of the application namespace and applications
are free to redefine those functions.
Reviewed by: emaste,jhb,markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D31964
---
sys/sys/endian.h | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sys/sys/endian.h b/sys/sys/endian.h
index d070d09ad9f7..faac0458ae2c 100644
--- a/sys/sys/endian.h
+++ b/sys/sys/endian.h
@@ -67,16 +67,16 @@ typedef __uint64_t uint64_t;
* 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 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 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))
@@ -84,16 +84,16 @@ typedef __uint64_t uint64_t;
#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 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))
+#define le16toh(x) __bswap16((x))
+#define le32toh(x) __bswap32((x))
+#define le64toh(x) __bswap64((x))
#endif /* _BYTE_ORDER == _LITTLE_ENDIAN */
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
More information about the dev-commits-src-all
mailing list