There already is a union to reference the memory as an array of uints, so just use it for IS_ADDR_UNSPECIFIED.
Also, all the other #defines aren't used anywhere so we can remove them. Signed-off-by: Andy Grover <[email protected]> --- iscsiuio/src/uip/ipv6.h | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/iscsiuio/src/uip/ipv6.h b/iscsiuio/src/uip/ipv6.h index 481f3aa..bc63762 100644 --- a/iscsiuio/src/uip/ipv6.h +++ b/iscsiuio/src/uip/ipv6.h @@ -142,32 +142,11 @@ struct mac_address { (memcmp((char *)a, (char *)b, sizeof(struct ipv6_addr)) == 0) /* Unspecified IPv6 address */ -#define IPV6_IS_ADDR_UNSPECIFIED(a) \ - ((*(u32_t *)(&(a)->addr8[0]) == 0) && \ - (*(u32_t *)(&(a)->addr8[4]) == 0) && \ - (*(u32_t *)(&(a)->addr8[8]) == 0) && \ - (*(u32_t *)(&(a)->addr8[12]) == 0)) - -/* Loopback IPv6 address */ -#define IPV6_IS_ADDR_LOOPBACK(a) \ - ((*(u32_t *)(&(a)->addr8[0]) == 0) && \ - (*(u32_t *)(&(a)->addr8[4]) == 0) && \ - (*(u32_t *)(&(a)->addr8[8]) == 0) && \ - (*(u32_t *)(&(a)->addr8[12]) == 0x1)) - -/* IPv4 compatible */ -#define IPV6_IS_ADDR_IPV4_COMPAT(a) \ - ((*(u32_t *)(&(a)->addr8[0]) == 0) && \ - (*(u32_t *)(&(a)->addr8[4]) == 0) && \ - (*(u32_t *)(&(a)->addr8[8]) == 0) && \ - (*(u32_t *)(&(a)->addr8[12]) != 0) && \ - (*(u32_t *)(&(a)->addr8[12]) != 0x1)) - -/* Mapped IPv4-IPv6 address */ -#define IPV6_IS_ADDR_IPV4_MAPPED(a) \ - ((*(u32_t *)(&(a)->addr8[0]) == 0) && \ - (*(u32_t *)(&(a)->addr8[4]) == 0) && \ - (*(u32_t *)(&(a)->addr8[8]) == ntohl(0x0000ffff))) +#define IPV6_IS_ADDR_UNSPECIFIED(a) \ + ((((a)->addr[0]) == 0) && \ + (((a)->addr[1]) == 0) && \ + (((a)->addr[2]) == 0) && \ + (((a)->addr[3]) == 0)) /* IPv6 Scope Values */ #define IPV6_ADDR_SCOPE_INTFACELOCAL 0x01 /* Node-local scope */ -- 1.9.3 -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/open-iscsi. For more options, visit https://groups.google.com/d/optout.
