[libc-commits] [libc] [libc] Add `IN6_IS_ADDR_{LINK, SITE}LOCAL` (PR #168207)

via libc-commits libc-commits at lists.llvm.org
Wed Dec 10 08:52:11 PST 2025


================
@@ -33,4 +33,12 @@
 #define INET_ADDRSTRLEN 16
 #define INET6_ADDRSTRLEN 46
 
+#define IN6_IS_ADDR_LINKLOCAL(a)                                               \
+  ((__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[0]) == 0xfe &&            \
+   (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[1] & 0xc0) == 0x80)
----------------
lntue wrote:

Do you mind adding the explanation + reference to a comment here, so that this question won't come up in the future?  Thanks,

https://github.com/llvm/llvm-project/pull/168207


More information about the libc-commits mailing list