From 8fdd5f1befb42d13a35934b0a10be84d054f1047 Mon Sep 17 00:00:00 2001 From: Christopher Dykes Date: Mon, 1 Aug 2016 15:09:57 -0700 Subject: [PATCH] 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 --- folly/Bits.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.34.1