mirror of
https://github.com/Dingo-Shenanigans/ReSkate.git
synced 2026-10-28 03:27:07 +01:00
1.0.0 Release!
This commit is contained in:
1 parent
706e191fbd
commit
ca1d82f636
1051 files changed
+607895
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#include "binary_io.h"
|
||||
|
||||
namespace dingosdk::frostbite {
|
||||
|
||||
std::string Guid::string() const {
|
||||
// Canonical text order swaps the first three fields, matching Studio.
|
||||
const std::array<std::byte, 16> canonical{
|
||||
bytes[3], bytes[2], bytes[1], bytes[0], bytes[5], bytes[4], bytes[7], bytes[6],
|
||||
bytes[8], bytes[9], bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]};
|
||||
constexpr char digits[] = "0123456789abcdef";
|
||||
std::string result;
|
||||
result.reserve(36);
|
||||
for (std::size_t index = 0; index < canonical.size(); ++index) {
|
||||
if (index == 4 || index == 6 || index == 8 || index == 10) result.push_back('-');
|
||||
const auto value = std::to_integer<std::uint8_t>(canonical[index]);
|
||||
result.push_back(digits[value >> 4]);
|
||||
result.push_back(digits[value & 0x0F]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace dingosdk::frostbite
|
||||
Reference in new issue
Block a user