From d94dcaefa020dcfc89d655dcf5aa8dad998e0bf2 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Sat, 5 Feb 2022 11:41:39 -0500 Subject: common: uuid: Add AsU128() This copies the internal bytes of the UUID into a u128 for backwards compatibility. This should not be used. --- src/common/new_uuid.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/common/new_uuid.cpp') 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; -- cgit v1.2.3