Skip to content

Commit

Permalink
[vcpkg] Fix bootstrap on VS2015 (microsoft#11891)
Browse files Browse the repository at this point in the history
* Fix boostrap on VS2015 by removing use of C++17 constexpr lambdas.
  • Loading branch information
BillyONeal authored Jun 12, 2020
1 parent 444fba5 commit 57476ca
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/vcpkg/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
Expand Down

0 comments on commit 57476ca

Please sign in to comment.