Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/intern/offset_indices.cc
| /* SPDX-License-Identifier: GPL-2.0-or-later */ | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||||
| #include "BLI_offset_indices.hh" | #include "BLI_offset_indices.hh" | ||||
| namespace blender::offset_indices { | namespace blender::offset_indices { | ||||
| void accumulate_counts_to_offsets(MutableSpan<int> counts_to_offsets, const int start_offset) | void accumulate_counts_to_offsets(MutableSpan<int> counts_to_offsets, const int start_offset) | ||||
| { | { | ||||
| int offset = start_offset; | int offset = start_offset; | ||||
| for (const int i : counts_to_offsets.index_range().drop_back(1)) { | for (const int i : counts_to_offsets.index_range().drop_back(1)) { | ||||
| const int count = counts_to_offsets[i]; | const int count = counts_to_offsets[i]; | ||||
| BLI_assert(count > 0); | BLI_assert(count >= 0); | ||||
| counts_to_offsets[i] = offset; | counts_to_offsets[i] = offset; | ||||
| offset += count; | offset += count; | ||||
| } | } | ||||
| counts_to_offsets.last() = offset; | counts_to_offsets.last() = offset; | ||||
| } | } | ||||
| } // namespace blender::offset_indices | } // namespace blender::offset_indices | ||||