[libc-commits] [libc] [libc] add `LLVM_LIBC_CAST` macro. (PR #127319)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Mon Feb 17 08:29:36 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)
----------------
jhuber6 wrote:
Could we just make the reinterpret cast implicit? Unsure if we'd ever need it.
https://github.com/llvm/llvm-project/pull/127319
More information about the libc-commits
mailing list