summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
5488222)
[ Edit by Mathieu Desnoyers: add a dbg_printf so the start-of-table
lookup prints the same dbg messages as normal lookups. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
assert(size > 0);
index = hash & (size - 1);
assert(size > 0);
index = hash & (size - 1);
+
+ if (index < ht->min_alloc_size) {
+ dbg_printf("lookup hash %lu index %lu order 0 aridx 0\n",
+ hash, index);
+ 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
* get_count_order_ulong.
*/
order = fls_ulong(index);
/*
* equivalent to get_count_order_ulong(index + 1), but optimizes
* away the non-existing 0 special-case for
* get_count_order_ulong.
*/
order = fls_ulong(index);
dbg_printf("lookup hash %lu index %lu order %lu aridx %lu\n",
dbg_printf("lookup hash %lu index %lu order %lu aridx %lu\n",
- hash, index, order, index & (!order ? 0 : ((1UL << (order - 1)) - 1)));
-
- return &ht->t.tbl[order]->nodes[index & (!order ? 0 : ((1UL << (order - 1)) - 1))];
+ hash, index, order, index & ((1UL << (order - 1)) - 1));
+ return &ht->t.tbl[order]->nodes[index & ((1UL << (order - 1)) - 1)];