lib/sort.c, 2.6.22 kernel
PATCH 1/1 lib/sort.c, 2.6.22 kernel
Hello, I fixed and tested a small bug in lib/sort.c file, heap sort function.
The fix avoids unnecessary swap of contents when i is 0 (saves few loads and stores),
which happens every time sort function is called. I felt the fix is worth bringing it
to your attention given the importance and frequent use of the sort function.
Thank you all.
==================================================================
lib/sort.c +1 -1
@@ -67,7 +67,7 @@ void sort(void *base, size_t num, size_t size, }/* sort */ -for (i = n - size; i >=0 ; i -= size) { +for (i = n - size; i >0 ; i -= size) {swap (base, base + i, size);for (r =0 ; r *2 + size < i; r = c) { c = r *2 + size;
Quoted 8 lines · Subbaiah Venkata
Hello, I fixed and tested a small bug in
lib/sort.cfile, heap sort function.The fix avoids unnecessary swap of contents when i is 0 (saves few loads and stores), which happens every time sort function is called. I felt the fix is worth bringing it to your attention given the importance and frequent use of the sort function.
Would you like to resubmit this? Please do ;) (I am hinting at Documentation/SubmittingPatches too..)
Quoted 15 lines
==================================================================
lib/sort.c +1
-1@@ -67,7 +67,7 @@ void sort(void *base, size_t num, size_t size, }/* sort */ -for (i = n - size; i >=0 ; i -= size) { +for (i = n - size; i >0 ; i -= size) {swap (base, base + i, size);for (r =0 ; r *2 + size < i; r = c) { c = r *2 + size;
Quoted 6 lines · Jan Engelhardt
Quoted 4 lines · Subbaiah Venkata
Hello, I fixed and tested a small bug in
lib/sort.cfile, heap sort function.
Quoted 7 lines
Quoted 4 lines
The fix avoids unnecessary swap of contents when i is 0 (saves few loads and stores), which happens every time sort function is called. I felt the fix is worth bringing it to your attention given the importance and frequent use of the sort function.
Would you like to resubmit this? Please do ;) (I am hinting at
Documentation/SubmittingPatchestoo..)
This is in -mm already.
Signature · 1 line
Mathematics is the supreme nostalgia of our time.