libluna: Fix a crash in quicksort
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
069f1c0f97
commit
51a5727c8d
@ -1,4 +1,5 @@
|
||||
#include <luna/Alignment.h>
|
||||
#include <luna/DebugLog.h>
|
||||
#include <luna/Sort.h>
|
||||
|
||||
static void swap_sized(void* ptr1, void* ptr2, usize size)
|
||||
@ -42,7 +43,7 @@ static void quicksort_impl(void* base, usize start, usize end, usize size, compa
|
||||
{
|
||||
usize pivot = partition(base, start, end, size, compar);
|
||||
if ((end - start) < 2) return;
|
||||
quicksort_impl(base, start, pivot - 1, size, compar);
|
||||
if (pivot > 0) quicksort_impl(base, start, pivot - 1, size, compar);
|
||||
quicksort_impl(base, pivot + 1, end, size, compar);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user