Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/BLI_span.hh')
-rw-r--r--source/blender/blenlib/BLI_span.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh
index 9ab096094de..0f3fcea1270 100644
--- a/source/blender/blenlib/BLI_span.hh
+++ b/source/blender/blenlib/BLI_span.hh
@@ -722,4 +722,16 @@ template<typename T> class MutableSpan {
}
};
+/** This is defined here, because in `BLI_index_range.hh` `Span` is not yet defined. */
+inline Span<int64_t> IndexRange::as_span() const
+{
+ const int64_t min_required_size = start_ + size_;
+ const int64_t current_array_size = s_current_array_size.load(std::memory_order_acquire);
+ const int64_t *current_array = s_current_array.load(std::memory_order_acquire);
+ if (min_required_size <= current_array_size) {
+ return Span<int64_t>(current_array + start_, size_);
+ }
+ return this->as_span_internal();
+}
+
} /* namespace blender */