Fix QuickSort regression taking a ptr to data causing memory overwrite
This commit is contained in:
parent
c1245619ff
commit
cbf8e37295
4
dqn.h
4
dqn.h
@ -930,11 +930,11 @@ DQN_FILE_SCOPE void DqnQuickSort(T *array, isize size, void *userContext)
|
|||||||
{
|
{
|
||||||
if (!IsLessThan(array[checkIndex], array[itemToInsertIndex], userContext))
|
if (!IsLessThan(array[checkIndex], array[itemToInsertIndex], userContext))
|
||||||
{
|
{
|
||||||
T *itemToInsert = array + itemToInsertIndex;
|
T itemToInsert = array[itemToInsertIndex];
|
||||||
for (i32 i = itemToInsertIndex; i > checkIndex; i--)
|
for (i32 i = itemToInsertIndex; i > checkIndex; i--)
|
||||||
array[i] = array[i - 1];
|
array[i] = array[i - 1];
|
||||||
|
|
||||||
array[checkIndex] = *itemToInsert;
|
array[checkIndex] = itemToInsert;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user