diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2023-06-22 22:22:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2023-06-22 22:22:04 -0700 |
commit | c7b4483840f371ffe5a531c46492e2cf9c4c6e1e (patch) | |
tree | c5821d858af7ed516ac0a6968970e09fca4d7511 /hash.c | |
parent | 82141a5d9e0114fbc138b3b6c4797e3c220de243 (diff) | |
download | txr-c7b4483840f371ffe5a531c46492e2cf9c4c6e1e.tar.gz txr-c7b4483840f371ffe5a531c46492e2cf9c4c6e1e.tar.bz2 txr-c7b4483840f371ffe5a531c46492e2cf9c4c6e1e.zip |
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.
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -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--; |