mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-17 14:16:10 -06:00
Core: Vector::Insert allocation reserve reduced to 50%
git-svn-id: svn://ultimatepp.org/upp/trunk@5739 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
bb5fbca76d
commit
8fd5e0e322
1 changed files with 1 additions and 1 deletions
|
|
@ -243,7 +243,7 @@ void Vector<T>::RawInsert(int q, int count)
|
|||
ASSERT(q >= 0 && q <= items);
|
||||
if(!count) return;
|
||||
if(items + count > alloc) {
|
||||
T *newvector = RawAlloc(alloc = alloc + ntl_max(alloc, count));
|
||||
T *newvector = RawAlloc(alloc = max(alloc + count, int(alloc + ((unsigned)alloc >> 1))));
|
||||
if(vector) {
|
||||
memcpy(newvector, vector, q * sizeof(T));
|
||||
memcpy(newvector + q + count, vector + q, (items - q) * sizeof(T));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue