X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FSupport%2FDeltaAlgorithm.cpp;h=9e52874de832689a8b5c71d554edb1d2f3977a3f;hb=be63d589633bbfa068b923c60eaaeee1b27647c5;hp=9aabd8d1a01ef1f7819f4e9db45a6e9f8b2ebf6e;hpb=a6d5e40e25e6b4fc856fa5cd10a59b8fdf51d9a7;p=oota-llvm.git diff --git a/lib/Support/DeltaAlgorithm.cpp b/lib/Support/DeltaAlgorithm.cpp index 9aabd8d1a01..9e52874de83 100644 --- a/lib/Support/DeltaAlgorithm.cpp +++ b/lib/Support/DeltaAlgorithm.cpp @@ -1,4 +1,4 @@ -//===--- DeltaAlgorithm.h - A Set Minimization Algorithm -------*- C++ -*--===// +//===--- DeltaAlgorithm.cpp - A Set Minimization Algorithm -----*- C++ -*--===// // // The LLVM Compiler Infrastructure // @@ -8,8 +8,12 @@ #include "llvm/ADT/DeltaAlgorithm.h" #include +#include using namespace llvm; +DeltaAlgorithm::~DeltaAlgorithm() { +} + bool DeltaAlgorithm::GetTestResult(const changeset_ty &Changes) { if (FailedTestsCache.count(Changes)) return false; @@ -26,10 +30,10 @@ void DeltaAlgorithm::Split(const changeset_ty &S, changesetlist_ty &Res) { // FIXME: This is really slow. changeset_ty LHS, RHS; - unsigned idx = 0; + unsigned idx = 0, N = S.size() / 2; for (changeset_ty::const_iterator it = S.begin(), ie = S.end(); it != ie; ++it, ++idx) - ((idx & 1) ? LHS : RHS).insert(*it); + ((idx < N) ? LHS : RHS).insert(*it); if (!LHS.empty()) Res.push_back(LHS); if (!RHS.empty())