diff options
Diffstat (limited to 'src/utils.h')
-rw-r--r-- | src/utils.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/utils.h b/src/utils.h index 275dbb5c..f4a0598c 100644 --- a/src/utils.h +++ b/src/utils.h @@ -36,7 +36,8 @@ namespace internal { // ---------------------------------------------------------------------------- // General helper functions -// Returns true iff x is a power of 2. Does not work for zero. +// 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; |