diff options
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg/metrics.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index d1acbed99..e2661d98a 100644 --- a/toolsrc/src/vcpkg/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -30,6 +30,14 @@ namespace vcpkg::Metrics return ""; } + struct append_hexits { + constexpr static char hex[17] = "0123456789abcdef"; + void operator()(std::string& res, std::uint8_t bits) const { + res.push_back(hex[(bits >> 4) & 0x0F]); + res.push_back(hex[(bits >> 0) & 0x0F]); + } + }; + // note: this ignores the bits of these numbers that would be where format and variant go static std::string uuid_of_integers(uint64_t top, uint64_t bottom) { @@ -40,11 +48,7 @@ namespace vcpkg::Metrics // uuid_field_size in hex characters, not bytes constexpr size_t uuid_size = 8 + 1 + 4 + 1 + 4 + 1 + 4 + 1 + 12; - constexpr static char hex[17] = "0123456789abcdef"; - constexpr static auto write_byte = [](std::string& res, std::uint8_t bits) { - res.push_back(hex[(bits >> 4) & 0x0F]); - res.push_back(hex[(bits >> 0) & 0x0F]); - }; + constexpr static append_hexits write_byte; // set the version bits to 4 top &= 0xFFFF'FFFF'FFFF'0FFFULL; |
