memmove instead of memcpy

This commit is contained in:
ZappoMan 2013-06-18 13:42:26 -07:00
parent 9466e81590
commit f978d748fa

View file

@ -423,10 +423,10 @@ int insertIntoSortedArrays(void* value, float key, int originalIndex,
// i is our desired location // i is our desired location
// shift array elements to the right // shift array elements to the right
if (i < currentCount && i+1 < maxCount) { if (i < currentCount && i+1 < maxCount) {
memcpy(&valueArray[i + 1], &valueArray[i], sizeof(void*) * (currentCount - i)); memmove(&valueArray[i + 1], &valueArray[i], sizeof(void*) * (currentCount - i));
memcpy(&keyArray[i + 1], &keyArray[i], sizeof(float) * (currentCount - i)); memmove(&keyArray[i + 1], &keyArray[i], sizeof(float) * (currentCount - i));
if (originalIndexArray) { if (originalIndexArray) {
memcpy(&originalIndexArray[i + 1], &originalIndexArray[i], sizeof(int) * (currentCount - i)); memmove(&originalIndexArray[i + 1], &originalIndexArray[i], sizeof(int) * (currentCount - i));
} }
} }
} }