* [kj] is_power_of_2 in net/core/neighbour.c
@ 2007-08-13 13:03 vignesh babu
2007-08-25 5:28 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: vignesh babu @ 2007-08-13 13:03 UTC (permalink / raw)
To: roque, kuznet, netdev; +Cc: netdev, Kernel Janitors List
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
---
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index ca2a153..f7de8f2 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -33,6 +33,7 @@
#include <linux/rtnetlink.h>
#include <linux/random.h>
#include <linux/string.h>
+#include <linux/log2.h>
#define NEIGH_DEBUG 1
@@ -311,7 +312,7 @@ static void neigh_hash_grow(struct neigh_table *tbl, unsigned long new_entries)
NEIGH_CACHE_STAT_INC(tbl, hash_grows);
- BUG_ON(new_entries & (new_entries - 1));
+ BUG_ON(!is_power_of_2(new_entries));
new_hash = neigh_hash_alloc(new_entries);
if (!new_hash)
return;
--
Vignesh Babu BM
_____________________________________________________________
"Why is it that every time I'm with you, makes me believe in magic?"
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [kj] is_power_of_2 in net/core/neighbour.c
2007-08-13 13:03 [kj] is_power_of_2 in net/core/neighbour.c vignesh babu
@ 2007-08-25 5:28 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-08-25 5:28 UTC (permalink / raw)
To: vigneshbabu, vignesh.babu; +Cc: roque, kuznet, netdev, kernel-janitors
From: vignesh babu <vignesh.babu@wipro.com>
Date: Mon, 13 Aug 2007 18:33:47 +0530
> Replacing n & (n - 1) for power of 2 check by is_power_of_2(n)
>
> Signed-off-by: vignesh babu <vignesh.babu@wipro.com>
Patch applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-25 5:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 13:03 [kj] is_power_of_2 in net/core/neighbour.c vignesh babu
2007-08-25 5:28 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).