Internal::ConstantInterval#

struct ConstantInterval#

A class to represent ranges of integers.

Can be unbounded above or below, but they cannot be empty.

Public Functions

ConstantInterval(int64_t min, int64_t max)#

Construct an interval from a lower and upper bound.

bool is_everything() const#

Is the interval the entire range.

bool is_single_point() const#

Is the interval just a single value (min == max).

bool is_single_point(int64_t x) const#

Is the interval a particular single value.

bool is_bounded() const#

Does the interval have a finite upper and lower bound.

void include(const ConstantInterval &i)#

Expand the interval to include another Interval.

void include(int64_t x)#

Expand the interval to include a point.

bool contains(int32_t x) const#

Test if the interval contains a particular value.

bool contains(int64_t x) const#

Test if the interval contains a particular value.

bool contains(uint64_t x) const#

Test if the interval contains a particular unsigned value.

bool contains(const ConstantInterval &other) const#

Test if this interval contains every value of another interval.

An unbounded side of the other interval is contained only if this interval is also unbounded on that side.

bool operator==(const ConstantInterval &other) const#

Equivalent to same_as.

Exists so that the autoscheduler can compare two map<string, Interval> for equality in order to cache computations.

void operator+=(const ConstantInterval &other)#

In-place versions of the arithmetic operators below.

ConstantInterval operator-() const#

Negate an interval.

void cast_to(const Type &t)#

Track what happens if a constant integer interval is forced to fit into a concrete integer type.

Public Members

int64_t min = 0#

The lower and upper bound of the interval.

They are included in the interval.

Public Static Functions

static ConstantInterval everything()#

The interval representing everything.

static ConstantInterval single_point(int64_t x)#

Construct an interval representing a single point.

static ConstantInterval bounded_below(int64_t min)#

Construct intervals bounded above or below.

static ConstantInterval make_union(const ConstantInterval &a, const ConstantInterval &b)#

Construct the smallest interval containing two intervals.

static ConstantInterval make_intersection(const ConstantInterval &a, const ConstantInterval &b)#

Construct the largest interval contained within two intervals.

Throws an error if the interval is empty.

static ConstantInterval bounds_of_type(Type)#

Get constant integer bounds on a type.