X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FDeltaAlgorithm.cpp;h=9e52874de832689a8b5c71d554edb1d2f3977a3f;hb=627190ed78c9c2752dfe7be6ea426690863d54e4;hp=a1e33114976bec28e3dabb0de69c4f5c8b4df689;hpb=c09b4c00aaab25676ca903a4e137ac19ccb7d637;p=oota-llvm.git diff --git a/lib/Support/DeltaAlgorithm.cpp b/lib/Support/DeltaAlgorithm.cpp index a1e33114976..9e52874de83 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())