| 68 | } |
| 69 | |
| 70 | size_t Slice::Size() const { |
| 71 | CHECK(IsBounded()); |
| 72 | if (stride_ > 0 && start_ >= end_) { return 0; } |
| 73 | if (stride_ < 0 && start_ <= end_) { return 0; } |
| 74 | return ((end_ - start_) + (stride_ - ((stride_ > 0) - (stride_ < 0)))) / stride_; |
| 75 | } |
| 76 | |
| 77 | bool Slice::IsContiguous() const { |
| 78 | CHECK(IsBounded()); |
no outgoing calls