[Commits] SDL: Quick fix for qsort off-by-one error.

libsdl.org revision control commits-owner at libsdl.org
Sat Mar 12 09:55:42 PST 2016


details:   https://hg.libsdl.org/SDL/rev/2f1eb5fa26ea
changeset: 10118:2f1eb5fa26ea
user:      Sam Lantinga <slouken at libsdl.org>
date:      Fri Mar 11 08:30:18 2016 -0800
description:
Quick fix for qsort off-by-one error.

diffstat:

 src/stdlib/SDL_qsort.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 2e3396e62aa6 -r 2f1eb5fa26ea src/stdlib/SDL_qsort.c
--- a/src/stdlib/SDL_qsort.c	Sun Feb 21 13:19:33 2016 -0500
+++ b/src/stdlib/SDL_qsort.c	Fri Mar 11 08:30:18 2016 -0800
@@ -411,7 +411,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned-1,size);
+  PreInsertion(SWAP_nonaligned,TRUNC_nonaligned,size);
   Insertion(SWAP_nonaligned);
   free(pivot);
 }
@@ -442,7 +442,7 @@
       Recurse(trunc)
     }
   }
-  PreInsertion(SWAP_aligned,TRUNC_aligned-1,size);
+  PreInsertion(SWAP_aligned,TRUNC_aligned,size);
   Insertion(SWAP_aligned);
   free(pivot);
 }
@@ -483,7 +483,7 @@
       Recurse(TRUNC_words)
     }
   }
-  PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES)-1,WORD_BYTES);
+  PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES),WORD_BYTES);
   /* Now do insertion sort. */
   last=((char*)base)+nmemb*WORD_BYTES;
   for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) {


More information about the commits mailing list