Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=995e4286a047b32aebf8ce540908edb7fbd93f76
Commit:     995e4286a047b32aebf8ce540908edb7fbd93f76
Parent:     e30618cbd1919df61b3f17486af44ac78c24cae5
Author:     Subbaiah Venkata <[EMAIL PROTECTED]>
AuthorDate: Tue Oct 16 23:27:06 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Wed Oct 17 08:42:52 2007 -0700

    lib/sort.c optimization
    
    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.
    
    Acked-by: Matt Mackall <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 lib/sort.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/sort.c b/lib/sort.c
index 9615678..6abbaf3 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -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;
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to