1 //===-- Support/MathExtras.h - Useful math functions -------------*- C++ -*--=//
3 // This file contains some functions that are useful for math stuff.
5 //===----------------------------------------------------------------------===//
7 #ifndef SUPPORT_MATH_EXTRAS_H
8 #define SUPPORT_MATH_EXTRAS_H
10 #include <Support/DataTypes.h>
12 inline unsigned log2(uint64_t C) {
14 for (getPow = 0; C > 1; ++getPow)
19 inline bool isPowerOf2(int64_t C, unsigned &getPow) {
21 if (C > 0 && C == (C & ~(C - 1))) {