DeltaAlgorithm.cpp (208954) | DeltaAlgorithm.cpp (210299) |
---|---|
1//===--- DeltaAlgorithm.cpp - A Set Minimization Algorithm -----*- C++ -*--===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7//===----------------------------------------------------------------------===// 8 --- 16 unchanged lines hidden (view full) --- 25 return Result; 26} 27 28void DeltaAlgorithm::Split(const changeset_ty &S, changesetlist_ty &Res) { 29 // FIXME: Allow clients to provide heuristics for improved splitting. 30 31 // FIXME: This is really slow. 32 changeset_ty LHS, RHS; | 1//===--- DeltaAlgorithm.cpp - A Set Minimization Algorithm -----*- C++ -*--===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7//===----------------------------------------------------------------------===// 8 --- 16 unchanged lines hidden (view full) --- 25 return Result; 26} 27 28void DeltaAlgorithm::Split(const changeset_ty &S, changesetlist_ty &Res) { 29 // FIXME: Allow clients to provide heuristics for improved splitting. 30 31 // FIXME: This is really slow. 32 changeset_ty LHS, RHS; |
33 unsigned idx = 0; | 33 unsigned idx = 0, N = S.size() / 2; |
34 for (changeset_ty::const_iterator it = S.begin(), 35 ie = S.end(); it != ie; ++it, ++idx) | 34 for (changeset_ty::const_iterator it = S.begin(), 35 ie = S.end(); it != ie; ++it, ++idx) |
36 ((idx & 1) ? LHS : RHS).insert(*it); | 36 ((idx < N) ? LHS : RHS).insert(*it); |
37 if (!LHS.empty()) 38 Res.push_back(LHS); 39 if (!RHS.empty()) 40 Res.push_back(RHS); 41} 42 43DeltaAlgorithm::changeset_ty 44DeltaAlgorithm::Delta(const changeset_ty &Changes, --- 70 unchanged lines hidden --- | 37 if (!LHS.empty()) 38 Res.push_back(LHS); 39 if (!RHS.empty()) 40 Res.push_back(RHS); 41} 42 43DeltaAlgorithm::changeset_ty 44DeltaAlgorithm::Delta(const changeset_ty &Changes, --- 70 unchanged lines hidden --- |