[Linux-decnet-user] [PATCH]is_power_of_2-decnet/dn_route.c
Brought to you by:
chrissie_c,
ph3-der-loewe
|
From: vignesh b. <vig...@wi...> - 2007-06-14 10:34:39
|
Replacing (n & (n-1)) in the context of power of 2 checks
with is_power_of_2
Signed-off-by: vignesh babu <vig...@wi...>
---
diff --git a/net/decnet/dn_route.c b/net/decnet/dn_route.c
index a8bf106..0a67706 100644
--- a/net/decnet/dn_route.c
+++ b/net/decnet/dn_route.c
@@ -76,6 +76,7 @@
#include <linux/netfilter_decnet.h>
#include <linux/rcupdate.h>
#include <linux/times.h>
+#include <linux/log2.h>
#include <asm/errno.h>
#include <net/netlink.h>
#include <net/neighbour.h>
@@ -1792,7 +1793,7 @@ void __init dn_route_init(void)
do {
dn_rt_hash_mask = (1UL << order) * PAGE_SIZE /
sizeof(struct dn_rt_hash_bucket);
- while(dn_rt_hash_mask & (dn_rt_hash_mask - 1))
+ while(!is_power_of_2(dn_rt_hash_mask))
dn_rt_hash_mask--;
dn_rt_hash_table = (struct dn_rt_hash_bucket *)
__get_free_pages(GFP_ATOMIC, order);
--
Vignesh Babu BM
_____________________________________________________________
"Why is it that every time I'm with you, makes me believe in magic?"
|