From c7b4483840f371ffe5a531c46492e2cf9c4c6e1e Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 22 Jun 2023 22:22:04 -0700 Subject: hash: rename some variables in remove algorithms hash.c (hash_remove): In the algorithm that moves cells forward in the cluster in order to avoid the use of tombstones, we use slightly better variables. The cell we are looking to replace is called wipe rather than start. The cryptic varaible name k is renamed to iprobe, because it the initial probe location for the cell at position i. --- hash.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hash.c b/hash.c index dddca0d7..432e8468 100644 --- a/hash.c +++ b/hash.c @@ -582,7 +582,7 @@ static val hash_remove(struct hash *h, ucnum victim) { val table = h->table; val *vec = table->v.vec; - ucnum start = victim, i = start, mask = h->mask; + ucnum wipe = victim, i = wipe, mask = h->mask; val cell = vec[i]; val ret = nil; val vicentry = vec[victim]; @@ -594,24 +594,24 @@ static val hash_remove(struct hash *h, ucnum victim) i = (i + 1) & mask; - while (i != start) { + while (i != wipe) { cell = vec[i]; if (cell == nil) { break; } else { ucnum hcode = cell->ch.hash; - ucnum k = hcode & mask; + ucnum iprobe = hcode & mask; - if ((i < start) ^ (k <= start) ^ (k > i)) { - vec[start] = vec[i]; - start = i; + if ((i < wipe) ^ (iprobe <= wipe) ^ (iprobe > i)) { + vec[wipe] = vec[i]; + wipe = i; } i = (i + 1) & h->mask; } } - vec[start] = nil; + vec[wipe] = nil; bug_unless (h->count > 0); h->count--; -- cgit v1.2.3