summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit6c704ebbf1dc549772c51b46f23bca8ab78e1e07 (patch)
treed08058e996dd9695f4b65159cb9ed27b3dfa0d95 /llvm/lib/Support/DeltaAlgorithm.cpp
parentcfe3b3b956af6af3a7d4ece852584294b22acbbe (diff)
downloadbcm5719-llvm-6c704ebbf1dc549772c51b46f23bca8ab78e1e07.tar.gz
bcm5719-llvm-6c704ebbf1dc549772c51b46f23bca8ab78e1e07.zip
Revert r171829 "Split changeset_ty using iterators instead of loops" as it breaks the VS2008 build
llvm-svn: 172411
Diffstat (limited to 'llvm/lib/Support/DeltaAlgorithm.cpp')
-rw-r--r--llvm/lib/Support/DeltaAlgorithm.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Support/DeltaAlgorithm.cpp b/llvm/lib/Support/DeltaAlgorithm.cpp
index a1e33114976..9e52874de83 100644
--- a/llvm/lib/Support/DeltaAlgorithm.cpp
+++ b/llvm/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())
OpenPOWER on IntegriCloud