Don't shift an int left while assigning it to a size_t
authorChristopher Dykes <cdykes@fb.com>
Wed, 27 Jul 2016 19:21:19 +0000 (12:21 -0700)
committerFacebook Github Bot 3 <facebook-github-bot-3-bot@fb.com>
Wed, 27 Jul 2016 19:23:38 +0000 (12:23 -0700)
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

folly/test/HashBenchmark.cpp

index f62223ef7a290cb420a3700fec97148b14c6791b..fc4398b6e6951e5ee0b6b10767117ddbe6369f08 100644 (file)
@@ -55,7 +55,7 @@ void addHashBenchmark(const std::string& name) {
   static std::deque<std::string> 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) {