[IPV6]: __ipv6_addr_diff() annotations and cleanup.
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 15 Nov 2006 04:56:33 +0000 (20:56 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:22:53 +0000 (21:22 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ipv6.h

index 4ca9e93decc5a4d9449a898b61a33dc8373143f3..00328b71a08cf053b6ed6b94c2b998073c9ab84f 100644 (file)
@@ -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));
        }
 
        /*