> On Jul 19, 2016, at 4:52 PM, Ben Pfaff <b...@ovn.org> wrote: > >> But what if we do the whole thing this way? >> >> #ifdef s6_addr32 >> #define s6_addrX s6_addr32 >> #define IPV6_FOR_EACH(VAR) for (int VAR = 0; VAR < 4; VAR++) >> #else >> #define s6_addrX s6_addr >> #define IPV6_FOR_EACH(VAR) for (int VAR = 0; VAR < 16; VAR++) >> #endif >> >> struct in6_addr >> ipv6_addr_bitand(const struct in6_addr *a, const struct in6_addr *b) >> { >> struct in6_addr dst; >> IPV6_FOR_EACH (i) { >> dst.s6_addrX[i] = a->s6_addrX[i] & b->s6_addrX[i]; >> } >> return dst; >> } >> >> struct in6_addr >> ipv6_addr_bitxor(const struct in6_addr *a, const struct in6_addr *b) >> { >> struct in6_addr dst; >> IPV6_FOR_EACH (i) { >> dst.s6_addrX[i] = a->s6_addrX[i] ^ b->s6_addrX[i]; >> } >> return dst; >> } >> >> bool >> ipv6_is_zero(const struct in6_addr *a) >> { >> IPV6_FOR_EACH (i) { >> if (a->s6_addrX[i]) { >> return false; >> } >> } >> return true; >> } >> >> > > Acked-by: Ben Pfaff <b...@ovn.org>
I agree this is cleaner. I've switched to the above method and added you to the author list. Thanks! --Justin _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev