aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorNicole Mazzuca <t-nimaz@microsoft.com>2019-07-10 17:39:04 -0700
committerNicole Mazzuca <t-nimaz@microsoft.com>2019-07-11 18:20:36 -0700
commitbb579072077153fabfa74acec852bce222265357 (patch)
tree835caef7d03a7ec3919763547f3d293cff895478 /toolsrc/include
parent5b76f24f35976739991941d3b6289fb78fd93648 (diff)
downloadvcpkg-bb579072077153fabfa74acec852bce222265357.tar.gz
vcpkg-bb579072077153fabfa74acec852bce222265357.zip
make it compile on macos under g++6
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/base/strings.h6
-rw-r--r--toolsrc/include/vcpkg/base/work_queue.h4
2 files changed, 6 insertions, 4 deletions
diff --git a/toolsrc/include/vcpkg/base/strings.h b/toolsrc/include/vcpkg/base/strings.h
index 82145b826..9890bedbc 100644
--- a/toolsrc/include/vcpkg/base/strings.h
+++ b/toolsrc/include/vcpkg/base/strings.h
@@ -191,7 +191,8 @@ namespace vcpkg::Strings
template <class Integral>
std::string b64url_encode(Integral x) {
static_assert(std::is_integral<Integral>::value, "b64url_encode must take an integer type");
- auto value = static_cast<std::make_unsigned_t<Integral>>(x);
+ using Unsigned = std::make_unsigned_t<Integral>;
+ auto value = static_cast<Unsigned>(x);
// 64 values, plus the implicit \0
constexpr static char map[0x41] =
@@ -202,8 +203,8 @@ namespace vcpkg::Strings
/*3*/ "wxyz0123456789-_"
;
- constexpr static std::make_unsigned_t<Integral> mask = 0x3F;
constexpr static int shift = 5;
+ constexpr static auto mask = (static_cast<Unsigned>(1) << shift) - 1;
std::string result;
// reserve ceiling(number of bits / 3)
@@ -212,6 +213,7 @@ namespace vcpkg::Strings
while (value != 0) {
char mapped_value = map[value & mask];
result.push_back(mapped_value);
+ value >>= shift;
}
return result;
diff --git a/toolsrc/include/vcpkg/base/work_queue.h b/toolsrc/include/vcpkg/base/work_queue.h
index 71e00a2ab..8a3d27538 100644
--- a/toolsrc/include/vcpkg/base/work_queue.h
+++ b/toolsrc/include/vcpkg/base/work_queue.h
@@ -103,7 +103,7 @@ namespace vcpkg {
m_actions.reserve(m_actions.size() + (last - first));
- std::move(first, last, std::back_insert_iterator(rng));
+ std::move(first, last, std::back_inserter(rng));
}
m_cv.notify_all();
@@ -122,7 +122,7 @@ namespace vcpkg {
m_actions.reserve(m_actions.size() + (last - first));
- std::copy(first, last, std::back_insert_iterator(rng));
+ std::copy(first, last, std::back_inserter(rng));
}
m_cv.notify_all();