Quellcode durchsuchen

common: uuid: Add AsU128()

This copies the internal bytes of the UUID into a u128 for backwards compatibility. This should not be used.
Morph vor 4 Jahren
Ursprung
Commit
d94dcaefa0
2 geänderte Dateien mit 9 neuen und 0 gelöschten Zeilen
  1. 6 0
      src/common/new_uuid.cpp
  2. 3 0
      src/common/new_uuid.h

+ 6 - 0
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;
 

+ 3 - 0
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".
      *