From 01856989542f8c0e13ed11d0eec78cd122a2a7da Mon Sep 17 00:00:00 2001 From: Dejan Jovanovic Date: Sat, 14 Mar 2015 00:24:24 -0700 Subject: Updating resize for occurence lists to properly resize the whole state. --- src/prop/minisat/core/SolverTypes.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/prop/minisat') diff --git a/src/prop/minisat/core/SolverTypes.h b/src/prop/minisat/core/SolverTypes.h index a6413e674..bc60542e7 100644 --- a/src/prop/minisat/core/SolverTypes.h +++ b/src/prop/minisat/core/SolverTypes.h @@ -340,7 +340,7 @@ class OccLists OccLists(const Deleted& d) : deleted(d) {} void init (const Idx& idx){ occs.growTo(toInt(idx)+1); dirty.growTo(toInt(idx)+1, 0); } - void resizeTo (const Idx& idx){ int shrinkSize = occs.size() - (toInt(idx) + 1); occs.shrink(shrinkSize); } + void resizeTo (const Idx& idx); // Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } Vec& operator[](const Idx& idx){ return occs[toInt(idx)]; } Vec& lookup (const Idx& idx){ if (dirty[toInt(idx)]) clean(idx); return occs[toInt(idx)]; } @@ -372,6 +372,19 @@ void OccLists::cleanAll() dirties.clear(); } +template +void OccLists::resizeTo(const Idx& idx) +{ + int shrinkSize = occs.size() - (toInt(idx) + 1); + occs.shrink(shrinkSize); + dirty.shrink(shrinkSize); + // Remove out-of-bound indices from dirties + int i, j; + for (i = j = 0; i < dirties.size(); i++) + if (toInt(dirties[i]) < occs.size()) + dirties[j++] = dirties[i]; + dirties.shrink(i - j); +} template void OccLists::clean(const Idx& idx) -- cgit v1.2.3