summaryrefslogtreecommitdiffstats
path: root/src/common/uuid.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/uuid.h')
-rw-r--r--src/common/uuid.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/common/uuid.h b/src/common/uuid.h
index aeb36939a..8ea01f8da 100644
--- a/src/common/uuid.h
+++ b/src/common/uuid.h
@@ -58,6 +58,13 @@ struct UUID {
uuid = INVALID_UUID;
}
+ [[nodiscard]] constexpr bool IsInvalid() const {
+ return uuid == INVALID_UUID;
+ }
+ [[nodiscard]] constexpr bool IsValid() const {
+ return !IsInvalid();
+ }
+
// TODO(ogniK): Properly generate a Nintendo ID
[[nodiscard]] constexpr u64 GetNintendoID() const {
return uuid[0];
@@ -69,3 +76,14 @@ struct UUID {
static_assert(sizeof(UUID) == 16, "UUID is an invalid size!");
} // 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