From: Christopher Dykes Date: Mon, 1 Aug 2016 22:09:57 +0000 (-0700) Subject: Fix nextPowTwo for 64-bit values under MSVC X-Git-Tag: v2016.08.08.00~43 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8fdd5f1befb42d13a35934b0a10be84d054f1047;p=folly.git Fix nextPowTwo for 64-bit values under MSVC Summary: A `long` is only 32-bits on MSVC, so this is simply wrong. Shift a `T` left instead. Reviewed By: yfeldblum Differential Revision: D3651139 fbshipit-source-id: 3bbfd18ed0c372287c4ec6cbcc543f6f1fcc4139 --- diff --git a/folly/Bits.h b/folly/Bits.h index 3bf1e329..e974c91d 100644 --- a/folly/Bits.h +++ b/folly/Bits.h @@ -185,7 +185,7 @@ typename std::enable_if< std::is_integral::value && std::is_unsigned::value, T>::type nextPowTwo(T v) { - return v ? (1ul << findLastSet(v - 1)) : 1; + return v ? (T(1) << findLastSet(v - 1)) : 1; } template