| 25 | } |
| 26 | |
| 27 | void Sorting::SortingStack::SetCapacity(const int32 capacity) |
| 28 | { |
| 29 | ASSERT(capacity >= 0); |
| 30 | if (capacity == Capacity) |
| 31 | return; |
| 32 | int32* newData = nullptr; |
| 33 | if (capacity > 0) |
| 34 | newData = (int32*)Allocator::Allocate(capacity * sizeof(int32)); |
| 35 | const int32 newCount = Count < capacity ? Count : capacity; |
| 36 | if (Data) |
| 37 | { |
| 38 | if (newData && newCount) |
| 39 | Platform::MemoryCopy(newData, Data, newCount * sizeof(int32)); |
| 40 | Allocator::Free(Data); |
| 41 | } |
| 42 | Data = newData; |
| 43 | Capacity = capacity; |
| 44 | Count = newCount; |
| 45 | } |
| 46 | |
| 47 | void Sorting::SortingStack::EnsureCapacity(int32 minCapacity) |
| 48 | { |
no test coverage detected