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

via libc-commits libc-commits at lists.llvm.org
Mon Dec 8 10:12:46 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:

I guess we are not worrying about endianness for now?

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


More information about the libc-commits mailing list