| Index: src/utils.h
|
| diff --git a/src/utils.h b/src/utils.h
|
| index 753822614cdac7de30fee972523cc2814509628f..845cb7555b2e56b9bfa0b0faa2e7f751d42623fc 100644
|
| --- a/src/utils.h
|
| +++ b/src/utils.h
|
| @@ -43,10 +43,10 @@ namespace internal {
|
| // ----------------------------------------------------------------------------
|
| // General helper functions
|
|
|
| -#define IS_POWER_OF_TWO(x) (((x) & ((x) - 1)) == 0)
|
| +#define IS_POWER_OF_TWO(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))
|
|
|
| -// Returns true iff x is a power of 2 (or zero). Cannot be used with the
|
| -// maximally negative value of the type T (the -1 overflows).
|
| +// Returns true iff x is a power of 2. Cannot be used with the maximally
|
| +// negative value of the type T (the -1 overflows).
|
| template <typename T>
|
| inline bool IsPowerOf2(T x) {
|
| return IS_POWER_OF_TWO(x);
|
| @@ -56,7 +56,6 @@ inline bool IsPowerOf2(T x) {
|
| // X must be a power of 2. Returns the number of trailing zeros.
|
| inline int WhichPowerOf2(uint32_t x) {
|
| ASSERT(IsPowerOf2(x));
|
| - ASSERT(x != 0);
|
| int bits = 0;
|
| #ifdef DEBUG
|
| int original_x = x;
|
|
|