Simplify ALLOC_STRATEGY_DOUBLE in arrays somewhat.

Increasing the constant to add elements always instead of having an extra-check for small numbers.
Behavior is similar to old one (adding 4 elements more for most numbers).


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5468 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2017-06-02 15:11:55 +00:00
parent 11c7de9000
commit 5bfba69e9d
3 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,7 @@
--------------------------
Changes in 1.9 (not yet released)
- Slightly simplified ALLOC_STRATEGY_DOUBLE in arrays
- Add alternavive BoundingBox calculation for BillboardSceneNode which can take in a camera node. Thx @Seven and @JacKDuRdEn for bugreports.
- FPS camera now supports keyboard rotation.
- Base FPS-camera movement on last position of mouse instead of always center (works better on platforms where cursor-placement is not allowed)

View File

@ -112,7 +112,7 @@ public:
enum eAllocStrategy
{
ALLOC_STRATEGY_SAFE = 0, // increase size by 1
ALLOC_STRATEGY_DOUBLE = 1, // increase at least 6, double size when under 500 elements, otherwise increase by 1/4th of number elements
ALLOC_STRATEGY_DOUBLE = 1, // double size when under 500 elements, beyond that increase by 1/4th size. Plus a small constant.
ALLOC_STRATEGY_SQRT = 2 // not implemented
};

View File

@ -145,8 +145,7 @@ public:
switch ( strategy )
{
case ALLOC_STRATEGY_DOUBLE:
newAlloc = used + 1 + (allocated < 500 ?
(allocated < 5 ? 5 : used) : used >> 2);
newAlloc = used + 5 + (allocated < 500 ? used : used >> 2);
break;
default:
case ALLOC_STRATEGY_SAFE: