mirror of
https://git.musl-libc.org/git/musl
synced 2025-03-19 00:52:55 +03:00
don't compare elements with themselves during qsort.
this is actually a workaround for a bug in gcc, whereby it asserts inequality of the keys being compared...
This commit is contained in:
parent
798a12ecc4
commit
b24bc15f5c
@ -28,7 +28,7 @@ static void sift(char *base, size_t root, size_t nel, size_t width, int (*cmp)(c
|
||||
max = 2*root;
|
||||
if (max < nel && cmp(base+max*width, base+(max+1)*width) < 0)
|
||||
max++;
|
||||
if (cmp(base+root*width, base+max*width) < 0) {
|
||||
if (max && cmp(base+root*width, base+max*width) < 0) {
|
||||
swap(base+root*width, base+max*width, width);
|
||||
root = max;
|
||||
} else break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user