Fix usage of C++14 constexpr in HasZeroOrOneBit

This commit is contained in:
Corentin Wallez 2017-04-26 15:10:41 -04:00 committed by Corentin Wallez
parent f07e3bd4c9
commit 0fba0b4811
1 changed files with 1 additions and 2 deletions

View File

@ -77,8 +77,7 @@ namespace nxt {
template<typename T> template<typename T>
constexpr bool HasZeroOrOneBits(T value) { constexpr bool HasZeroOrOneBits(T value) {
using Integral = typename UnderlyingType<T>::type; using Integral = typename UnderlyingType<T>::type;
Integral v = static_cast<Integral>(value); return (static_cast<Integral>(value) & (static_cast<Integral>(value) - 1)) == 0;
return (v & (v - 1)) == 0;
} }
template<typename T1, typename T2, typename = typename std::enable_if< template<typename T1, typename T2, typename = typename std::enable_if<