summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2022-02-05 11:41:39 -0500
committerMorph <39850852+Morph1984@users.noreply.github.com>2022-02-05 13:56:21 -0500
commitd94dcaefa020dcfc89d655dcf5aa8dad998e0bf2 (patch)
tree38bf667bdcb89d9fa11bc80af39a79381b2480e3 /src
parentf0340b8d22c8e2d9319726b8d90f9b3a3636882e (diff)
common: uuid: Add AsU128()
This copies the internal bytes of the UUID into a u128 for backwards compatibility. This should not be used.
Diffstat (limited to 'src')
-rw-r--r--src/common/new_uuid.cpp6
-rw-r--r--src/common/new_uuid.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/src/common/new_uuid.cpp b/src/common/new_uuid.cpp
index 0442681c8..f2f0077ae 100644
--- a/src/common/new_uuid.cpp
+++ b/src/common/new_uuid.cpp
@@ -144,6 +144,12 @@ size_t NewUUID::Hash() const noexcept {
return hash ^ std::rotl(temp, 1);
}
+u128 NewUUID::AsU128() const {
+ u128 uuid_old;
+ std::memcpy(&uuid_old, uuid.data(), sizeof(NewUUID));
+ return uuid_old;
+}
+
NewUUID NewUUID::MakeRandom() {
std::random_device device;
diff --git a/src/common/new_uuid.h b/src/common/new_uuid.h
index bd4468ad2..44665ad5a 100644
--- a/src/common/new_uuid.h
+++ b/src/common/new_uuid.h
@@ -83,6 +83,9 @@ struct NewUUID {
*/
size_t Hash() const noexcept;
+ /// DO NOT USE. Copies the contents of the UUID into a u128.
+ u128 AsU128() const;
+
/**
* Creates a default UUID "yuzu Default UID".
*