mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-09-08 00:59:08 +01:00
common: uuid: Add hash function for UUID
Used when UUID is a key in an unordered_map. The hash is produced by XORing the high and low 64-bits of the UUID together.
This commit is contained in:
parent
e1a92db519
commit
d20c5ac720
1 changed files with 11 additions and 0 deletions
|
@ -69,3 +69,14 @@ struct UUID {
|
||||||
static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
|
static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
|
||||||
|
|
||||||
} // namespace Common
|
} // namespace Common
|
||||||
|
|
||||||
|
namespace std {
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct hash<Common::UUID> {
|
||||||
|
size_t operator()(const Common::UUID& uuid) const noexcept {
|
||||||
|
return uuid.uuid[1] ^ uuid.uuid[0];
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
Loading…
Reference in a new issue