From 8fd5e0e322e1bcc3ec9c60697bb5aa255cd97a77 Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 27 Jan 2013 16:53:58 +0000 Subject: [PATCH] Core: Vector::Insert allocation reserve reduced to 50% git-svn-id: svn://ultimatepp.org/upp/trunk@5739 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Vcont.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uppsrc/Core/Vcont.hpp b/uppsrc/Core/Vcont.hpp index 7c0eec80b..1b925ccbd 100644 --- a/uppsrc/Core/Vcont.hpp +++ b/uppsrc/Core/Vcont.hpp @@ -243,7 +243,7 @@ void Vector::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));