AK: Add the ability to hash the contents of a AK::HashMap

This commit is contained in:
Brian Gianforcaro 2021-09-11 20:17:40 -07:00 committed by Andreas Kling
parent df04283d61
commit 54fe0c8855
Notes: sideshowbarker 2024-07-18 04:08:14 +09:00

View file

@ -165,6 +165,16 @@ public:
return list; return list;
} }
[[nodiscard]] u32 hash() const
{
u32 hash = 0;
for (auto& it : *this) {
auto entry_hash = pair_int_hash(it.key.hash(), it.value.hash());
hash = pair_int_hash(hash, entry_hash);
}
return hash;
}
private: private:
HashTableType m_table; HashTableType m_table;
}; };