diff options
Diffstat (limited to 'source/blender/blenlib/BLI_stack.hh')
-rw-r--r-- | source/blender/blenlib/BLI_stack.hh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/blenlib/BLI_stack.hh b/source/blender/blenlib/BLI_stack.hh index a5a95186e37..422931862a8 100644 --- a/source/blender/blenlib/BLI_stack.hh +++ b/source/blender/blenlib/BLI_stack.hh @@ -60,7 +60,7 @@ template<typename T> struct StackChunk { /** Pointer to one element past the end of the referenced buffer. */ T *capacity_end; - uint capacity() const + int64_t capacity() const { return capacity_end - begin; } @@ -77,7 +77,7 @@ template< * When T is large, the small buffer optimization is disabled by default to avoid large * unexpected allocations on the stack. It can still be enabled explicitly though. */ - uint InlineBufferCapacity = (sizeof(T) < 100) ? 4 : 0, + int64_t InlineBufferCapacity = (sizeof(T) < 100) ? 4 : 0, /** * The allocator used by this stack. Should rarely be changed, except when you don't want that * MEM_* is used internally. @@ -103,7 +103,7 @@ class Stack { /** * Number of elements in the entire stack. The sum of initialized element counts in the chunks. */ - uint size_; + int64_t size_; /** The buffer used to implement small object optimization. */ TypedBuffer<T, InlineBufferCapacity> inline_buffer_; @@ -298,8 +298,8 @@ class Stack { this->activate_next_chunk(remaining_values.size()); } - const uint remaining_capacity = top_chunk_->capacity_end - top_; - const uint amount = std::min(remaining_values.size(), remaining_capacity); + const int64_t remaining_capacity = top_chunk_->capacity_end - top_; + const int64_t amount = std::min(remaining_values.size(), remaining_capacity); uninitialized_copy_n(remaining_values.data(), amount, top_); top_ += amount; @@ -320,7 +320,7 @@ class Stack { /** * Returns the number of elements in the stack. */ - uint size() const + int64_t size() const { return size_; } @@ -344,11 +344,11 @@ class Stack { * * This invokes undefined behavior when the currently active chunk is not full. */ - void activate_next_chunk(const uint size_hint) + void activate_next_chunk(const int64_t size_hint) { BLI_assert(top_ == top_chunk_->capacity_end); if (top_chunk_->above == nullptr) { - const uint new_capacity = std::max(size_hint, top_chunk_->capacity() * 2 + 10); + const int64_t new_capacity = std::max(size_hint, top_chunk_->capacity() * 2 + 10); /* Do a single memory allocation for the Chunk and the array it references. */ void *buffer = allocator_.allocate( |