forceinline int ValSelRangeMin::val(const Space&, IntView x, int) { if (x.range()) { return (x.width() == 2) ? x.min() : (x.min() + (x.max()-x.min())/2); } else { ViewRanges<View> r(x); return r.max(); } }
forceinline int ValSelRangeMax::val(const Space&, IntView x, int) { if (x.range()) { return (x.width() == 2) ? x.max() : (x.max() - (x.max()-x.min())/2); } else { int min; ViewRanges<IntView> r(x); do { min = r.min(); ++r; } while (r()); return min; } }
forceinline void IntTraceView::prune(Space& home, IntView y, const Delta& d) { if (y.range() && (dom->next() == NULL)) { dom->min(y.min()); dom->max(y.max()); } else if (!y.any(d) && (y.max(d)+1 == y.min())) { // The lower bound has been adjusted if (y.min() > dom->max()) { RangeList* p = dom; RangeList* l = p->next(); while ((l != NULL) && (l->max() < y.min())) { p=l; l=l->next(); } dom->dispose(home,p); dom = l; } dom->min(y.min()); } else if (!y.any(d) && (y.max()+1 == y.min(d))) { // upper bound has been adjusted if ((y.max() <= dom->max()) && (dom->next() == NULL)) { dom->max(y.max()); } else { RangeList* p = dom; RangeList* l = p->next(); while ((l != NULL) && (l->min() <= y.max())) { p=l; l=l->next(); } p->max(y.max()); if (p->next() != NULL) p->next()->dispose(home); p->next(NULL); } } else { // Just copy the domain ViewRanges<IntView> yr(y); RangeList::overwrite(home,dom,yr); } }