Skip to content

Commit

Permalink
QHash: Add and use a Bucket helper class
Browse files Browse the repository at this point in the history
Introduces a QHashPrivate::Data::Bucket class. This class
helps avoid repeated bitshift and masking operations when
locating bucket entries in the hash.

Change signature of some internal methods to use Bucket
instead of the private iterator, so we can avoid repeated
encoding/decoding steps for the bucket index.

Task-number: QTBUG-91739
Task-number: QTBUG-98436
Change-Id: I9ed2205bf886f9c20a5be109fd88456eec4d1540
Reviewed-by: Marc Mutz <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
laknoll authored and Morten242 committed Dec 17, 2021
1 parent 340b2a1 commit 9c9cdbe
Show file tree
Hide file tree
Showing 2 changed files with 173 additions and 97 deletions.
2 changes: 1 addition & 1 deletion src/corelib/tools/qcache.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class QCache
n->prev->next = n->next;
n->next->prev = n->prev;
total -= n->value.cost;
auto it = d.find(n->key);
auto it = d.findBucket(n->key);
d.erase(it);
}
T *relink(const Key &key) const noexcept
Expand Down
Loading

0 comments on commit 9c9cdbe

Please sign in to comment.