summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2025-01-14 11:48:39 -0500
committerPeter LaFosse <peter@vector35.com>2025-01-14 14:08:45 -0500
commit0cea9333ac85d372cfa4be639e2fa4148153b3dc (patch)
tree18ca94592f3c26c5c6be280f3f6d6e226373bf82
parent35a4bd1a697f627edd19862c6b1afacfc7f754c4 (diff)
Add hash for XrefItem
-rw-r--r--ui/xreflist.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/ui/xreflist.h b/ui/xreflist.h
index e9df2df8..ea1ce610 100644
--- a/ui/xreflist.h
+++ b/ui/xreflist.h
@@ -117,6 +117,17 @@ class XrefItem
int row() const;
bool operator==(const XrefItem& other) const;
bool operator!=(const XrefItem& other) const;
+ size_t operator()(const XrefItem& item) const
+ {
+ size_t hash = std::hash<uint64_t>()(item.addr());
+ hash ^= std::hash<int>()(item.type()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ hash ^= std::hash<int>()(item.direction()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ hash ^= std::hash<int>()(item.kind()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ hash ^= std::hash<size_t>()(item.instrId()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ hash ^= std::hash<uint64_t>()(item.func() ? item.func()->GetStart() : 0) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ hash ^= std::hash<int>()(item.ilType()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
+ return hash;
+ }
};
/*!