#ifndef HALIDE_INTERVAL_H
#define HALIDE_INTERVAL_H
#include "Expr.h"
namespace Halide {
namespace Internal {
struct Interval {
static Expr pos_inf, neg_inf;
Expr min, max;
Interval() : min(neg_inf), max(pos_inf) {}
Interval(Expr min, Expr max) : min(min), max(max) {
internal_assert(min.defined() && max.defined());
}
static Interval everything() {return Interval(neg_inf, pos_inf);}
static Interval nothing() {return Interval(pos_inf, neg_inf);}
static Interval single_point(Expr e) {return Interval(e, e);}
bool is_empty() const {return min.same_as(pos_inf) || max.same_as(neg_inf);}
bool is_everything() const {return min.same_as(neg_inf) && max.same_as(pos_inf);}
bool is_single_point() const {return min.same_as(max);}
bool is_single_point(Expr e) const {return min.same_as(e) && max.same_as(e);}
bool has_upper_bound() const {return !max.same_as(pos_inf) && !is_empty();}
bool has_lower_bound() const {return !min.same_as(neg_inf) && !is_empty();}
bool is_bounded() const {return has_upper_bound() && has_lower_bound();}
bool same_as(const Interval &other) {return min.same_as(other.min) && max.same_as(other.max);}
EXPORT void include(const Interval &i);
EXPORT void include(Expr e);
EXPORT static Interval make_union(const Interval &a, const Interval &b);
EXPORT static Interval make_intersection(const Interval &a, const Interval &b);
EXPORT static Expr make_max(Expr a, Expr b);
EXPORT static Expr make_min(Expr a, Expr b);
};
EXPORT void interval_test();
}
}
#endif