[llvm-commits] CVS: llvm/include/Support/MathExtras.h
Chris Lattner
lattner at cs.uiuc.edu
Tue Aug 17 12:17:23 PDT 2004
Changes in directory llvm/include/Support:
MathExtras.h updated: 1.13 -> 1.14
---
Log message:
Add an overload
---
Diffs of the changes: (+7 -0)
Index: llvm/include/Support/MathExtras.h
diff -u llvm/include/Support/MathExtras.h:1.13 llvm/include/Support/MathExtras.h:1.14
--- llvm/include/Support/MathExtras.h:1.13 Tue Jul 20 22:15:14 2004
+++ llvm/include/Support/MathExtras.h Tue Aug 17 14:17:10 2004
@@ -29,6 +29,13 @@
return getPow;
}
+inline unsigned log2(unsigned C) {
+ unsigned getPow;
+ for (getPow = 0; C > 1; ++getPow)
+ C >>= 1;
+ return getPow;
+}
+
inline bool isPowerOf2(int64_t C, unsigned &getPow) {
if (C < 0) C = -C;
if (C > 0 && C == (C & ~(C - 1))) {
More information about the llvm-commits
mailing list