#include "tensorstore/index_interval.h"
Result<IndexInterval>
tensorstore::ShiftInterval(IndexInterval interval,
                           
Index min_offset,
                           
Index max_offset);
Result<IndexInterval>
tensorstore::ShiftInterval(IndexInterval intervalIndex offset);

Adds an offset to the min and max bounds of an interval.

If interval.inclusive_min() == -kInfIndex, it is not shifted. Likewise, if interval.inclusive_max() == -kInfIndex, it is also not shifted.

Parameters:
IndexInterval interval

Original interval to shift.

Index min_offset

Amount to add to interval.inclusive_min().

Index max_offset

Amount to add to interval.inclusive_max().

Index offset

Amount to add to interval.inclusive_min() and interval.inclusive_max().

Returns:

The shifted interval.

Error absl::StatusCode::kInvalidArgument:

if the resultant inclusive_min or inclusive_max value would be outside the valid range.