[llvm-commits] [llvm] r105613 - /llvm/trunk/lib/Support/DeltaAlgorithm.cpp

Daniel Dunbar daniel at zuster.org
Tue Jun 8 09:21:26 PDT 2010


Author: ddunbar
Date: Tue Jun  8 11:21:26 2010
New Revision: 105613

URL: http://llvm.org/viewvc/llvm-project?rev=105613&view=rev
Log:
DeltaAlgorithm: Tweak split to split by first/second half instead of even/odd, since adjacent changes are more likely to be related.

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

Modified: llvm/trunk/lib/Support/DeltaAlgorithm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/DeltaAlgorithm.cpp?rev=105613&r1=105612&r2=105613&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DeltaAlgorithm.cpp (original)
+++ llvm/trunk/lib/Support/DeltaAlgorithm.cpp Tue Jun  8 11:21:26 2010
@@ -30,10 +30,10 @@
 
   // FIXME: This is really slow.
   changeset_ty LHS, RHS;
-  unsigned idx = 0;
+  unsigned idx = 0, N = S.size() / 2;
   for (changeset_ty::const_iterator it = S.begin(),
          ie = S.end(); it != ie; ++it, ++idx)
-    ((idx & 1) ? LHS : RHS).insert(*it);
+    ((idx < N) ? LHS : RHS).insert(*it);
   if (!LHS.empty())
     Res.push_back(LHS);
   if (!RHS.empty())





More information about the llvm-commits mailing list