mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-17 18:31:04 +00:00
Split changeset_ty using iterators instead of loops.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0fecdfb7c4
commit
c09b4c00aa
@ -27,13 +27,15 @@ 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())
|
||||
|
Loading…
Reference in New Issue
Block a user