git: 6f3e6234f8be - stable/13 - endian.h: Use the __bswap* versions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 24 Jan 2023 23:28:24 UTC
The branch stable/13 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6f3e6234f8be61d0332409300565790a7cad919c commit 6f3e6234f8be61d0332409300565790a7cad919c Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2021-09-21 04:02:35 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2023-01-24 23:26:27 +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 (cherry picked from commit 44fb3c695f5e672ec00bdef0fa0f13793e6269a1) --- 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. */