Skip to content

Commit c2dbb37

Browse files
committed
Lookahead: fix bugs
1 parent f47533b commit c2dbb37

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/tsolvers/lasolver/LASolver.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -636,16 +636,15 @@ bool LASolver::wouldDeduce(PtAsgn asgn) const {
636636
LABound const & bound = boundStore[boundRef];
637637

638638
auto searchForUnassignedBound = [this, &bound, &v](BoundT type) {
639-
for (int it = bound.getIdx().x - 1; it >= 0; -- it) {
640-
LABoundRef candidateRef = boundStore.getBoundByIdx(v, it);
639+
int newId = bound.getIdx().x + (type == bound_l ? -2 : 2);
640+
if (newId < 0 or newId > boundStore.getBounds(v).size() - 1) {
641+
return false;
642+
} else {
643+
LABoundRef candidateRef = boundStore.getBoundByIdx(v, newId);
641644
LABound const & candidate = boundStore[candidateRef];
642-
if (candidate.getType() != type) {
643-
continue;
644-
} else if (not hasPolarity(getAsgnByBound(candidateRef).tr)) {
645-
return true;
646-
}
645+
assert(candidate.getType() == type);
646+
return (not hasPolarity(getAsgnByBound(candidateRef).tr));
647647
}
648-
return false;
649648
};
650649

651650
if (bound.getType() == bound_l) {

0 commit comments

Comments
 (0)