Signed-off-by: Lai Jiangshan <[email protected]>
---
 rculfhash.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/rculfhash.c b/rculfhash.c
index 32ea649..851bbef 100644
--- a/rculfhash.c
+++ b/rculfhash.c
@@ -741,6 +741,10 @@ struct _cds_lfht_node *lookup_bucket(struct cds_lfht *ht, 
unsigned long size,
 
        assert(size > 0);
        index = hash & (size - 1);
+
+       if (index < ht->min_alloc_size)
+               return &ht->t.tbl[0]->nodes[index];
+
        /*
         * equivalent to get_count_order_ulong(index + 1), but optimizes
         * away the non-existing 0 special-case for
@@ -749,9 +753,9 @@ struct _cds_lfht_node *lookup_bucket(struct cds_lfht *ht, 
unsigned long size,
        order = fls_ulong(index);
 
        dbg_printf("lookup hash %lu index %lu order %lu aridx %lu\n",
-                  hash, index, order, index & (!order ? 0 : ((1UL << (order - 
1)) - 1)));
+                  hash, index, order, index & ((1UL << (order - 1)) - 1));
 
-       return &ht->t.tbl[order]->nodes[index & (!order ? 0 : ((1UL << (order - 
1)) - 1))];
+       return &ht->t.tbl[order]->nodes[index & ((1UL << (order - 1)) - 1)];
 }
 
 /*
-- 
1.7.4.4


_______________________________________________
ltt-dev mailing list
[email protected]
http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev

Reply via email to