| Index: src/utils.h
|
| diff --git a/src/utils.h b/src/utils.h
|
| index 1c7120eaf2041b809a8026421643a4ea4cdba022..ed6d9a4fee1c7e6158ec88fe8d607825cb609c79 100644
|
| --- a/src/utils.h
|
| +++ b/src/utils.h
|
| @@ -37,11 +37,13 @@ namespace internal {
|
| // ----------------------------------------------------------------------------
|
| // General helper functions
|
|
|
| +#define IS_POWER_OF_TWO(x) (((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).
|
| template <typename T>
|
| static inline bool IsPowerOf2(T x) {
|
| - return (x & (x - 1)) == 0;
|
| + return IS_POWER_OF_TWO(x);
|
| }
|
|
|
|
|
|
|