summaryrefslogtreecommitdiffstats
path: root/src/ck_rhs.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 07:50:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-08 07:50:14 +0000
commit7020f6bf1e08bb16ab742cfd17b109e196096ee2 (patch)
tree7ef0713cfca533a50589c9c64577c7986b485042 /src/ck_rhs.c
parentAdding upstream version 0.7.1. (diff)
downloadck-7020f6bf1e08bb16ab742cfd17b109e196096ee2.tar.xz
ck-7020f6bf1e08bb16ab742cfd17b109e196096ee2.zip
Adding upstream version 0.7.2.upstream/0.7.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/ck_rhs.c')
-rw-r--r--src/ck_rhs.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/ck_rhs.c b/src/ck_rhs.c
index 1d6b0f0..aaf1d71 100644
--- a/src/ck_rhs.c
+++ b/src/ck_rhs.c
@@ -914,6 +914,8 @@ ck_rhs_put_robin_hood(struct ck_rhs *hs,
long prev;
void *key;
long prevs[CK_RHS_MAX_RH];
+ int prev_probes[CK_RHS_MAX_RH];
+ long last_slot = -1;
unsigned int prevs_nb = 0;
unsigned int i;
@@ -938,8 +940,13 @@ restart:
if (ck_rhs_grow(hs, map->capacity << 1) == false) {
desc->in_rh = false;
- for (i = 0; i < prevs_nb; i++)
+ for (i = 0; i < prevs_nb; i++) {
+ if (i > 0)
+ ck_rhs_set_probes(map, prevs[i], prev_probes[i - 1]);
ck_rhs_unset_rh(map, prevs[i]);
+ }
+ if (last_slot != -1)
+ ck_rhs_set_probes(map, last_slot, prev_probes[prevs_nb - 1]);
return -1;
}
@@ -951,10 +958,13 @@ restart:
desc = ck_rhs_desc(map, first);
int old_probes = desc->probes;
+ last_slot = first;
+
desc->probes = n_probes;
h = ck_rhs_get_first_offset(map, first, n_probes);
ck_rhs_map_bound_set(map, h, n_probes);
prev = orig_slot;
+ prev_probes[prevs_nb] = old_probes;
prevs[prevs_nb++] = prev;
n_probes = old_probes;
goto restart;