Fix QuickSort regression taking a ptr to data causing memory overwrite

This commit is contained in:
Doyle T 2018-07-15 21:45:50 +10:00
parent c1245619ff
commit cbf8e37295

4
dqn.h
View File

@ -930,11 +930,11 @@ DQN_FILE_SCOPE void DqnQuickSort(T *array, isize size, void *userContext)
{
if (!IsLessThan(array[checkIndex], array[itemToInsertIndex], userContext))
{
T *itemToInsert = array + itemToInsertIndex;
T itemToInsert = array[itemToInsertIndex];
for (i32 i = itemToInsertIndex; i > checkIndex; i--)
array[i] = array[i - 1];
array[checkIndex] = *itemToInsert;
array[checkIndex] = itemToInsert;
break;
}
}