Skip to content

Commit 0cea933

Browse files
committed
Add hash for XrefItem
1 parent 35a4bd1 commit 0cea933

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ui/xreflist.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@ class XrefItem
117117
int row() const;
118118
bool operator==(const XrefItem& other) const;
119119
bool operator!=(const XrefItem& other) const;
120+
size_t operator()(const XrefItem& item) const
121+
{
122+
size_t hash = std::hash<uint64_t>()(item.addr());
123+
hash ^= std::hash<int>()(item.type()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
124+
hash ^= std::hash<int>()(item.direction()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
125+
hash ^= std::hash<int>()(item.kind()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
126+
hash ^= std::hash<size_t>()(item.instrId()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
127+
hash ^= std::hash<uint64_t>()(item.func() ? item.func()->GetStart() : 0) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
128+
hash ^= std::hash<int>()(item.ilType()) + 0x9e3779b9 + (hash << 6) + (hash >> 2);
129+
return hash;
130+
}
120131
};
121132

122133
/*!

0 commit comments

Comments
 (0)