summaryrefslogtreecommitdiff
path: root/lib/Support/DeltaAlgorithm.cpp
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2013-01-14 14:13:06 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2013-01-14 14:13:06 +0000
commit800ec3da7af7b73cd3c61d5da53d9d7c8343ad83 (patch)
treee8722d05efe41c6f03f11a5e0ff7dd0d7ca07718 /lib/Support/DeltaAlgorithm.cpp
parent29344a6349af5e37b1187de5d354cb95a5840e13 (diff)
downloadllvm-800ec3da7af7b73cd3c61d5da53d9d7c8343ad83.tar.gz
llvm-800ec3da7af7b73cd3c61d5da53d9d7c8343ad83.tar.bz2
llvm-800ec3da7af7b73cd3c61d5da53d9d7c8343ad83.tar.xz
Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/DeltaAlgorithm.cpp')
-rw-r--r--lib/Support/DeltaAlgorithm.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Support/DeltaAlgorithm.cpp b/lib/Support/DeltaAlgorithm.cpp
index a1e3311497..9e52874de8 100644
--- a/lib/Support/DeltaAlgorithm.cpp
+++ b/lib/Support/DeltaAlgorithm.cpp
@@ -27,15 +27,13 @@ bool DeltaAlgorithm::GetTestResult(const changeset_ty &Changes) {
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())