[llvm-commits] [llvm] r172411 - /llvm/trunk/lib/Support/DeltaAlgorithm.cpp
Timur Iskhodzhanov
timurrrr at google.com
Mon Jan 14 06:13:07 PST 2013
Author: timurrrr
Date: Mon Jan 14 08:13:06 2013
New Revision: 172411
URL: http://llvm.org/viewvc/llvm-project?rev=172411&view=rev
Log:
Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build
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=172411&r1=172410&r2=172411&view=diff
==============================================================================
--- llvm/trunk/lib/Support/DeltaAlgorithm.cpp (original)
+++ llvm/trunk/lib/Support/DeltaAlgorithm.cpp Mon Jan 14 08:13:06 2013
@@ -27,15 +27,13 @@
void DeltaAlgorithm::Split(const changeset_ty &S, changesetlist_ty &Res) {
// FIXME: Allow clients to provide heuristics for improved splitting.
- // Get the iterator to the middle.
- unsigned N = S.size() / 2;
- changeset_ty::iterator middle(S.begin());
- std::advance(middle, N);
-
- // Create each vector using the middle as the split.
- changeset_ty LHS(S.begin(), middle);
- changeset_ty RHS(middle, S.end());
+ // FIXME: This is really slow.
+ changeset_ty LHS, RHS;
+ unsigned idx = 0, N = S.size() / 2;
+ for (changeset_ty::const_iterator it = S.begin(),
+ ie = S.end(); it != ie; ++it, ++idx)
+ ((idx < N) ? LHS : RHS).insert(*it);
if (!LHS.empty())
Res.push_back(LHS);
if (!RHS.empty())
More information about the llvm-commits
mailing list