aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ipv6.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ipv6.h')
-rw-r--r--include/net/ipv6.h15
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)
394 */ 394 */
395static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen) 395static inline int __ipv6_addr_diff(const void *token1, const void *token2, int addrlen)
396{ 396{
397 const __u32 *a1 = token1, *a2 = token2; 397 const __be32 *a1 = token1, *a2 = token2;
398 int i; 398 int i;
399 399
400 addrlen >>= 2; 400 addrlen >>= 2;
401 401
402 for (i = 0; i < addrlen; i++) { 402 for (i = 0; i < addrlen; i++) {
403 __u32 xb = a1[i] ^ a2[i]; 403 __be32 xb = a1[i] ^ a2[i];
404 if (xb) { 404 if (xb)
405 int j = 31; 405 return i * 32 + 32 - fls(ntohl(xb));
406
407 xb = ntohl(xb);
408 while ((xb & (1 << j)) == 0)
409 j--;
410
411 return (i * 32 + 31 - j);
412 }
413 } 406 }
414 407
415 /* 408 /*