diff options
author | Giuliano Procida <gprocida@google.com> | 2023-01-16 13:21:51 +0000 |
---|---|---|
committer | Matthias Maennich <maennich@google.com> | 2023-01-17 18:41:02 +0000 |
commit | 950144d62a85157bf3333d857ab0b689941fd69a (patch) | |
tree | 4331f94bd73afe387cb67d1e343102481f146ae3 /equality_cache.h | |
parent | 8edcc739fba57c453afbaf32d5c07a745977e7de (diff) | |
download | stg-950144d62a85157bf3333d857ab0b689941fd69a.tar.gz |
hashing: give hash values a name
This will make it easier and safer to try out different hashing schemes.
This is a mostly mechanical replacement of `uint32_t` with `HashValue`.
The latter is currently a type alias but will change to a wrapper struct
for better type safety and to avoid some useless overhashing.
PiperOrigin-RevId: 502360037
Change-Id: I093133abef810713009f6fb34a085b65a7ba0ce1
Diffstat (limited to 'equality_cache.h')
-rw-r--r-- | equality_cache.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/equality_cache.h b/equality_cache.h index 377efa6..dcd5ef2 100644 --- a/equality_cache.h +++ b/equality_cache.h @@ -26,6 +26,7 @@ #include "equality.h" #include "graph.h" +#include "hashing.h" #include "metrics.h" namespace stg { @@ -43,8 +44,8 @@ namespace stg { // Node hashes such as those generated by the Fingerprint function object may be // supplied to avoid equality testing when hashes differ. struct EqualityCache { - EqualityCache(const std::unordered_map<Id, uint32_t>& hashes, - Metrics& metrics) + EqualityCache(const std::unordered_map<Id, HashValue>& hashes, + Metrics& metrics) : hashes(hashes), query_count(metrics, "cache.query_count"), query_equal_ids(metrics, "cache.query_equal_ids"), @@ -200,7 +201,7 @@ struct EqualityCache { } } - const std::unordered_map<Id, uint32_t>& hashes; + const std::unordered_map<Id, HashValue>& hashes; std::unordered_map<Id, Id> mapping; std::unordered_map<Id, size_t> rank; std::unordered_map<Id, std::unordered_set<Id>> inequalities; |