| 134 | * describe the range including row pitch when using image2D |
| 135 | */ |
| 136 | struct Span { |
| 137 | ptrdiff_t low_elem, low_byte; |
| 138 | size_t high_elem, high_byte; |
| 139 | //! The differece between high_elem and last elem is that last_elem describes |
| 140 | //! the last element of a tensor regardless of the row pitch at the last row. It |
| 141 | //! will be useful when copying into a part of image. |
| 142 | size_t last_elem, last_byte; |
| 143 | |
| 144 | Span(ptrdiff_t low_elem, ptrdiff_t low_byte, size_t high_elem, size_t high_byte, |
| 145 | size_t last_elem, size_t last_byte) |
| 146 | : low_elem(low_elem), |
| 147 | low_byte(low_byte), |
| 148 | high_elem(high_elem), |
| 149 | high_byte(high_byte), |
| 150 | last_elem(last_elem), |
| 151 | last_byte(last_byte) {} |
| 152 | size_t dist_elem() const { return high_elem - low_elem; } |
| 153 | |
| 154 | size_t dist_byte() const { return high_byte - low_byte; } |
| 155 | |
| 156 | size_t dist_last_byte() const { return last_byte - low_byte; } |
| 157 | }; |
| 158 | |
| 159 | /*! |
| 160 | * \brief Describing the requirements for tensor layouts |