diff options
author | vignesh babu <vignesh.babu@wipro.com> | 2007-08-25 01:27:55 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-08-26 21:35:37 -0400 |
commit | c3609d510f844100669965db8a9ff10ba029bb4a (patch) | |
tree | fb86593f7310805bb6c70cf2b61f4e7b3731d7aa /net | |
parent | 26722873a460703e319462afa7ebb8ed3a036c07 (diff) |
[NET]: is_power_of_2 in net/core/neighbour.c
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/neighbour.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index ca2a1533138a..f7de8f24d8dd 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/rtnetlink.h> | 33 | #include <linux/rtnetlink.h> |
34 | #include <linux/random.h> | 34 | #include <linux/random.h> |
35 | #include <linux/string.h> | 35 | #include <linux/string.h> |
36 | #include <linux/log2.h> | ||
36 | 37 | ||
37 | #define NEIGH_DEBUG 1 | 38 | #define NEIGH_DEBUG 1 |
38 | 39 | ||
@@ -311,7 +312,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries) | |||
311 | 312 | ||
312 | NEIGH_CACHE_STAT_INC(tbl, hash_grows); | 313 | NEIGH_CACHE_STAT_INC(tbl, hash_grows); |
313 | 314 | ||
314 | BUG_ON(new_entries & (new_entries - 1)); | 315 | BUG_ON(!is_power_of_2(new_entries)); |
315 | new_hash = neigh_hash_alloc(new_entries); | 316 | new_hash = neigh_hash_alloc(new_entries); |
316 | if (!new_hash) | 317 | if (!new_hash) |
317 | return; | 318 | return; |