From: Christopher Dykes Date: Wed, 27 Jul 2016 19:21:19 +0000 (-0700) Subject: Don't shift an int left while assigning it to a size_t X-Git-Tag: v2016.07.29.00~6 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=5d90c1385188d4632ce9a0f0e6bc5b83d4cf5138 Don't shift an int left while assigning it to a size_t Summary: MSVC gives warnings if you shift a 32-bit value left but then assign it to a 64-bit variable. This just makes it a 64-bit shift instead. If we really wanted, this doesn't need to be a size_t to begin with, but it already is, so just leave it alone. Reviewed By: yfeldblum Differential Revision: D3622935 fbshipit-source-id: 25931e6df644df8a2160aa80fd5de21cd9c06159 --- diff --git a/folly/test/HashBenchmark.cpp b/folly/test/HashBenchmark.cpp index f62223ef..fc4398b6 100644 --- a/folly/test/HashBenchmark.cpp +++ b/folly/test/HashBenchmark.cpp @@ -55,7 +55,7 @@ void addHashBenchmark(const std::string& name) { static std::deque names; for (size_t i = 0; i < 16; ++i) { - size_t k = 1 << i; + auto k = size_t(1) << i; names.emplace_back(folly::sformat("{}: k=2^{}",name, i)); folly::addBenchmark(__FILE__, names.back().c_str(), [=] (unsigned iters) {