core: use memcpy and reserve function

newMem is a new memory allocated by "new". There is no way that is
overlap with previous allocation. Therefore the faster memcpy can be used safely
This commit is contained in:
Gregory Hainaut 2014-11-24 10:00:46 +01:00
parent 60f7ec03c2
commit 0f2f25845d
1 changed files with 2 additions and 3 deletions

View File

@ -53,7 +53,7 @@ class BaseBlockArray {
pxAssert(size > 0); pxAssert(size > 0);
BASEBLOCKEX *newMem = new BASEBLOCKEX[size]; BASEBLOCKEX *newMem = new BASEBLOCKEX[size];
if(blocks) { if(blocks) {
memmove(newMem, blocks, _Reserved * sizeof(BASEBLOCKEX)); memcpy(newMem, blocks, _Reserved * sizeof(BASEBLOCKEX));
delete[] blocks; delete[] blocks;
} }
blocks = newMem; blocks = newMem;
@ -84,8 +84,7 @@ public:
BASEBLOCKEX *insert(u32 startpc, uptr fnptr) BASEBLOCKEX *insert(u32 startpc, uptr fnptr)
{ {
if(_Size + 1 >= _Reserved) { if(_Size + 1 >= _Reserved) {
resize(_Reserved + 0x2000); reserve(_Reserved + 0x2000); // some games requires even more!
_Reserved += 0x2000; // some games requires even more!
} }
int imin = 0, imax = _Size, imid; int imin = 0, imax = _Size, imid;