File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 3838// int and takes a single argument of type const struct in6_addr *:
3939// https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/netinet_in.h.html
4040
41+ #define IN6_IS_ADDR_UNSPECIFIED (a ) \
42+ ((__LLVM_LIBC_CAST(reinterpret_cast, uint32_t *, a)[0]) == 0 && \
43+ (__LLVM_LIBC_CAST(reinterpret_cast, uint32_t *, a)[1]) == 0 && \
44+ (__LLVM_LIBC_CAST(reinterpret_cast, uint32_t *, a)[2]) == 0 && \
45+ (__LLVM_LIBC_CAST(reinterpret_cast, uint32_t *, a)[3]) == 0)
46+
4147#define IN6_IS_ADDR_LINKLOCAL (a ) \
4248 ((__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[0]) == 0xfe && \
4349 (__LLVM_LIBC_CAST(reinterpret_cast, uint8_t *, a)[1] & 0xc0) == 0x80)
Original file line number Diff line number Diff line change 1212TEST (LlvmLibcNetinetInTest, IN6Macro) {
1313 char buff[16 ] = {};
1414
15+ EXPECT_TRUE (IN6_IS_ADDR_UNSPECIFIED (buff));
16+ for (int i = 0 ; i < 16 ; ++i) {
17+ buff[i] = 1 ;
18+ EXPECT_FALSE (IN6_IS_ADDR_UNSPECIFIED (buff));
19+ }
20+
1521 buff[0 ] = 0xfe ;
1622 buff[1 ] = 0x80 ;
1723 EXPECT_TRUE (IN6_IS_ADDR_LINKLOCAL (buff));
You can’t perform that action at this time.
0 commit comments