Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174194457
D51919.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D51919.diff
View Options
diff --git a/sys/libkern/qsort.c b/sys/libkern/qsort.c
--- a/sys/libkern/qsort.c
+++ b/sys/libkern/qsort.c
@@ -114,11 +114,10 @@
char *pa, *pb, *pc, *pd, *pl, *pm, *pn;
size_t d1, d2;
int cmp_result;
- int swaptype_long, swaptype_int, swap_cnt;
+ int swaptype_long, swaptype_int;
loop: SWAPINIT(long, a, es);
SWAPINIT(int, a, es);
- swap_cnt = 0;
if (n < 7) {
for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
for (pl = pm;
@@ -147,7 +146,6 @@
for (;;) {
while (pb <= pc && (cmp_result = CMP(thunk, pb, a)) <= 0) {
if (cmp_result == 0) {
- swap_cnt = 1;
swap(pa, pb);
pa += es;
}
@@ -155,7 +153,6 @@
}
while (pb <= pc && (cmp_result = CMP(thunk, pc, a)) >= 0) {
if (cmp_result == 0) {
- swap_cnt = 1;
swap(pc, pd);
pd -= es;
}
@@ -164,18 +161,9 @@
if (pb > pc)
break;
swap(pb, pc);
- swap_cnt = 1;
pb += es;
pc -= es;
}
- if (swap_cnt == 0) { /* Switch to insertion sort */
- for (pm = (char *)a + es; pm < (char *)a + n * es; pm += es)
- for (pl = pm;
- pl > (char *)a && CMP(thunk, pl - es, pl) > 0;
- pl -= es)
- swap(pl, pl - es);
- return;
- }
pn = (char *)a + n * es;
d1 = MIN(pa - (char *)a, pb - pa);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 7:04 AM (14 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40067297
Default Alt Text
D51919.diff (1 KB)
Attached To
Mode
D51919: libkern: Drop incorrect qsort optimization
Attached
Detach File
Event Timeline
Log In to Comment