RE: [PATCH net-next?] pktgen: Use simpler test for non-zero ipv6 address

From: David Laight
Date: Thu Oct 11 2012 - 04:10:18 EST


> - if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[1] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[2] == 0 &&
> - pkt_dev->min_in6_daddr.s6_addr32[3] == 0) ;
> - else {
> + if (pkt_dev->min_in6_daddr.s6_addr32[0] |
> + pkt_dev->min_in6_daddr.s6_addr32[1] |
> + pkt_dev->min_in6_daddr.s6_addr32[2] |
> + pkt_dev->min_in6_daddr.s6_addr32[3]) {

Given the likely values, it might be worth using:
if (pkt_dev->min_in6_daddr.s6_addr32[0] == 0 &&
pkt_dev->min_in6_daddr.s6_addr32[1] |
pkt_dev->min_in6_daddr.s6_addr32[2] |
pkt_dev->min_in6_daddr.s6_addr32[3]) {

David



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/