Skip to content

Commit

Permalink
[IPV6]: __ipv6_addr_diff() annotations and cleanup.
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Al Viro authored and David S. Miller committed Dec 3, 2006
1 parent e69a4ad commit ef296f5
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

/*
Expand Down

0 comments on commit ef296f5

Please sign in to comment.