mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 15:14:19 +02:00
Merge pull request #548 from ZappoMan/master
memmove instead of memcpy for known overlapping copies
This commit is contained in:
commit
9a7e8c4471
1 changed files with 3 additions and 3 deletions
|
@ -423,10 +423,10 @@ int insertIntoSortedArrays(void* value, float key, int originalIndex,
|
|||
// i is our desired location
|
||||
// shift array elements to the right
|
||||
if (i < currentCount && i+1 < maxCount) {
|
||||
memcpy(&valueArray[i + 1], &valueArray[i], sizeof(void*) * (currentCount - i));
|
||||
memcpy(&keyArray[i + 1], &keyArray[i], sizeof(float) * (currentCount - i));
|
||||
memmove(&valueArray[i + 1], &valueArray[i], sizeof(void*) * (currentCount - i));
|
||||
memmove(&keyArray[i + 1], &keyArray[i], sizeof(float) * (currentCount - i));
|
||||
if (originalIndexArray) {
|
||||
memcpy(&originalIndexArray[i + 1], &originalIndexArray[i], sizeof(int) * (currentCount - i));
|
||||
memmove(&originalIndexArray[i + 1], &originalIndexArray[i], sizeof(int) * (currentCount - i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue