projects
/
folly.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
800802c
)
Fix nextPowTwo for 64-bit values under MSVC
author
Christopher Dykes
<cdykes@fb.com>
Mon, 1 Aug 2016 22:09:57 +0000
(15:09 -0700)
committer
Facebook Github Bot 6
<facebook-github-bot-6-bot@fb.com>
Mon, 1 Aug 2016 22:23:28 +0000
(15:23 -0700)
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
patch
|
blob
|
history
diff --git
a/folly/Bits.h
b/folly/Bits.h
index 3bf1e32954c9d48bf90f1aea30077f86ad4ce7f9..e974c91d3ae46073b21a155a9ab7cb7e5bb1503d 100644
(file)
--- a/
folly/Bits.h
+++ b/
folly/Bits.h
@@
-185,7
+185,7
@@
typename std::enable_if<
std::is_integral<T>::value && std::is_unsigned<T>::value,
T>::type
nextPowTwo(T v) {
- return v ? (
1ul
<< findLastSet(v - 1)) : 1;
+ return v ? (
T(1)
<< findLastSet(v - 1)) : 1;
}
template <class T>