mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-10-31 15:20:10 +00:00
Add exponential behaviour to pool growth reallocation
This commit is contained in:
parent
fcad801685
commit
0fbb32403c
@ -55,7 +55,7 @@ DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index)
|
||||
dbg_assert(index >= this->size);
|
||||
dbg_assert(index < Tmax_size);
|
||||
|
||||
size_t new_size = std::min(Tmax_size, Align(index + 1, std::max<uint>(64, Tgrowth_step)));
|
||||
size_t new_size = std::min<size_t>(Tmax_size, Align(std::max<uint>(index + 1, (this->size * 3) / 2), std::max<uint>(64, Tgrowth_step)));
|
||||
|
||||
this->data = ReallocT(this->data, new_size);
|
||||
MemSetT(this->data + this->size, 0, new_size - this->size);
|
||||
|
Loading…
Reference in New Issue
Block a user