Update BitHelpers.h

This commit is contained in:
alexey-milovidov 2020-08-02 19:09:51 +03:00 committed by GitHub
parent 49d32cc815
commit ae572c3a7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@ inline unsigned int bitScanReverse(unsigned int x)
inline size_t roundUpToPowerOfTwoOrZero(size_t n) inline size_t roundUpToPowerOfTwoOrZero(size_t n)
{ {
// if MSB is set, return n, to avoid return zero // if MSB is set, return n, to avoid return zero
if (unlikely(n & 1ULL<<(sizeof(size_t)*CHAR_BIT-1))) if (unlikely(n >= 0x8000000000000000ULL))
return n; return n;
--n; --n;