aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/bihash_template.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2020-03-27 16:57:28 +0100
committerDave Barach <openvpp@barachs.net>2020-03-27 17:03:30 +0000
commit4e149776890a5ac91bb14957d57def3c73325061 (patch)
tree1ed2d2ceee7f92f2ac367cdd78f35bab9415e461 /src/vppinfra/bihash_template.c
parent491741a40443a66edd497bb15007198404500352 (diff)
vppinfra: add clib_bihash_get_bucket
Type: improvement Change-Id: I073bb7bea2a55eabbb6c253b003966f0a821e4a3 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vppinfra/bihash_template.c')
-rw-r--r--src/vppinfra/bihash_template.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/vppinfra/bihash_template.c b/src/vppinfra/bihash_template.c
index 2b378427ce8..471251d04d1 100644
--- a/src/vppinfra/bihash_template.c
+++ b/src/vppinfra/bihash_template.c
@@ -472,7 +472,6 @@ static inline int BV (clib_bihash_add_del_inline)
(BVT (clib_bihash) * h, BVT (clib_bihash_kv) * add_v, int is_add,
int (*is_stale_cb) (BVT (clib_bihash_kv) *, void *), void *arg)
{
- u32 bucket_index;
BVT (clib_bihash_bucket) * b, tmp_b;
BVT (clib_bihash_value) * v, *new_v, *save_new_v, *working_copy;
int i, limit;
@@ -499,8 +498,7 @@ static inline int BV (clib_bihash_add_del_inline)
hash = BV (clib_bihash_hash) (add_v);
- bucket_index = hash & (h->nbuckets - 1);
- b = &h->buckets[bucket_index];
+ b = BV (clib_bihash_get_bucket) (h, hash);
hash >>= h->log2_nbuckets;
@@ -758,7 +756,6 @@ int BV (clib_bihash_search)
BVT (clib_bihash_kv) * search_key, BVT (clib_bihash_kv) * valuep)
{
u64 hash;
- u32 bucket_index;
BVT (clib_bihash_value) * v;
BVT (clib_bihash_bucket) * b;
int i, limit;
@@ -770,8 +767,7 @@ int BV (clib_bihash_search)
hash = BV (clib_bihash_hash) (search_key);
- bucket_index = hash & (h->nbuckets - 1);
- b = &h->buckets[bucket_index];
+ b = BV (clib_bihash_get_bucket) (h, hash);
if (BV (clib_bihash_bucket_is_empty) (b))
return -1;