[llvm-commits] [llvm] r152545 - /llvm/trunk/lib/Support/APInt.cpp

Benjamin Kramer benny.kra at googlemail.com
Sun Mar 11 12:32:35 PDT 2012


Author: d0k
Date: Sun Mar 11 14:32:35 2012
New Revision: 152545

URL: http://llvm.org/viewvc/llvm-project?rev=152545&view=rev
Log:
Replace a hand-coded leading one counting loop with the magic from MathExtras.h.

Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=152545&r1=152544&r2=152545&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Sun Mar 11 14:32:35 2012
@@ -723,14 +723,7 @@
 }
 
 static unsigned countLeadingOnes_64(uint64_t V, unsigned skip) {
-  unsigned Count = 0;
-  if (skip)
-    V <<= skip;
-  while (V && (V & (1ULL << 63))) {
-    Count++;
-    V <<= 1;
-  }
-  return Count;
+  return CountLeadingOnes_64(V << skip);
 }
 
 unsigned APInt::countLeadingOnes() const {





More information about the llvm-commits mailing list