diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-14 20:56:33 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-02 21:22:53 -0800 |
commit | ef296f56f8501f3ac68b8d44f63205f544126733 (patch) | |
tree | 0e1bc449f5cdd0f7c155ea0f8dfb14ffc6f164b9 /include/net/ipv6.h | |
parent | e69a4adc669fe210817ec50ae3f9a7a5ad62d4e8 (diff) | |
download | lwn-ef296f56f8501f3ac68b8d44f63205f544126733.tar.gz lwn-ef296f56f8501f3ac68b8d44f63205f544126733.zip |
[IPV6]: __ipv6_addr_diff() annotations and cleanup.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r-- | include/net/ipv6.h | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 4ca9e93decc5..00328b71a08c 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -394,22 +394,15 @@ static inline int ipv6_addr_any(const struct in6_addr *a) */ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) { - const __u32 *a1 = token1, *a2 = token2; + const __be32 *a1 = token1, *a2 = token2; int i; addrlen >>= 2; for (i = 0; i < addrlen; i++) { - __u32 xb = a1[i] ^ a2[i]; - if (xb) { - int j = 31; - - xb = ntohl(xb); - while ((xb & (1 << j)) == 0) - j--; - - return (i * 32 + 31 - j); - } + __be32 xb = a1[i] ^ a2[i]; + if (xb) + return i * 32 + 32 - fls(ntohl(xb)); } /* |