diff --git a/src/base/intmath.hh b/src/base/intmath.hh index 0b22ba0dbd..ee5cf66c84 100644 --- a/src/base/intmath.hh +++ b/src/base/intmath.hh @@ -61,20 +61,6 @@ isPrime(const T& n) return true; } -template -inline T -leastSigBit(const T& n) -{ - return n & ~(n - 1); -} - -template -inline bool -isPowerOf2(const T& n) -{ - return n != 0 && leastSigBit(n) == n; -} - inline uint64_t power(uint32_t n, uint32_t e) { @@ -179,6 +165,13 @@ ceilLog2(const T& n) return floorLog2(n - (T)1) + 1; } +template +inline bool +isPowerOf2(const T& n) +{ + return n != 0 && floorLog2(n) == ceilLog2(n); +} + template inline T floorPow2(const T& n)