Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenlib/BLI_linear_allocator.hh
| Show First 20 Lines • Show All 196 Lines • ▼ Show 20 Lines | #endif | ||||
| void provide_buffer(AlignedBuffer<Size, Alignment> &aligned_buffer) | void provide_buffer(AlignedBuffer<Size, Alignment> &aligned_buffer) | ||||
| { | { | ||||
| this->provide_buffer(aligned_buffer.ptr(), Size); | this->provide_buffer(aligned_buffer.ptr(), Size); | ||||
| } | } | ||||
| private: | private: | ||||
| void allocate_new_buffer(int64_t min_allocation_size, int64_t min_alignment) | void allocate_new_buffer(int64_t min_allocation_size, int64_t min_alignment) | ||||
| { | { | ||||
| for (int64_t i : unused_borrowed_buffers_.index_range()) { | for (int64_t i : iter_indices(unused_borrowed_buffers_)) { | ||||
| Span<char> buffer = unused_borrowed_buffers_[i]; | Span<char> buffer = unused_borrowed_buffers_[i]; | ||||
| if (buffer.size() >= min_allocation_size) { | if (buffer.size() >= min_allocation_size) { | ||||
| unused_borrowed_buffers_.remove_and_reorder(i); | unused_borrowed_buffers_.remove_and_reorder(i); | ||||
| current_begin_ = (uintptr_t)buffer.begin(); | current_begin_ = (uintptr_t)buffer.begin(); | ||||
| current_end_ = (uintptr_t)buffer.end(); | current_end_ = (uintptr_t)buffer.end(); | ||||
| return; | return; | ||||
| } | } | ||||
| } | } | ||||
| Show All 27 Lines | |||||