BLI: Remove clamping from generic span slicing

Similar to a5e7657cee
This commit is contained in:
Hans Goudey 2023-05-03 11:41:13 -04:00
parent 42cdd39618
commit 1f76863f80
1 changed files with 4 additions and 4 deletions

View File

@ -91,8 +91,8 @@ class GSpan {
{
BLI_assert(start >= 0);
BLI_assert(size >= 0);
const int64_t new_size = std::max<int64_t>(0, std::min(size, size_ - start));
return GSpan(type_, POINTER_OFFSET(data_, type_->size() * start), new_size);
BLI_assert(start + size <= size_ || size == 0);
return GSpan(type_, POINTER_OFFSET(data_, type_->size() * start), size);
}
GSpan slice(const IndexRange range) const
@ -218,8 +218,8 @@ class GMutableSpan {
{
BLI_assert(start >= 0);
BLI_assert(size >= 0);
const int64_t new_size = std::max<int64_t>(0, std::min(size, size_ - start));
return GMutableSpan(*type_, POINTER_OFFSET(data_, type_->size() * start), new_size);
BLI_assert(start + size <= size_ || size == 0);
return GMutableSpan(type_, POINTER_OFFSET(data_, type_->size() * start), size);
}
GMutableSpan slice(IndexRange range) const