[libc-commits] [libc] [libc] add `LLVM_LIBC_CAST` macro. (PR #127319)
Michael Jones via libc-commits
libc-commits at lists.llvm.org
Tue Feb 18 14:51:25 PST 2025
================
@@ -20,27 +20,27 @@
#define htobe16(x) __builtin_bswap16((x))
#define htobe32(x) __builtin_bswap32((x))
#define htobe64(x) __builtin_bswap64((x))
-#define htole16(x) ((uint16_t)(x))
-#define htole32(x) ((uint32_t)(x))
-#define htole64(x) ((uint64_t)(x))
+#define htole16(x) __LLVM_LIBC_CAST(reinterpret_cast, uint16_t, x)
----------------
michaelrj-google wrote:
I don't think this should be a `reinterpret_cast`. Since these types should be compatible I think this should be a `static_cast`.
https://github.com/llvm/llvm-project/pull/127319
More information about the libc-commits
mailing list