]> pd.if.org Git - pdclib/commitdiff
Thinko pointed out by Brian Damgaard.
authorsolar <unknown>
Fri, 12 Mar 2010 11:06:16 +0000 (11:06 +0000)
committersolar <unknown>
Fri, 12 Mar 2010 11:06:16 +0000 (11:06 +0000)
Notes.txt
functions/stdlib/qsort.c

index aa065037216f789fb6910075096a262d20084200..dd85931d8e2f0d9d2fb81d2e28fed991eee7a0eb 100644 (file)
--- a/Notes.txt
+++ b/Notes.txt
@@ -1,4 +1,4 @@
-$Id$
+$Id$
 
 Credits
 =======
@@ -31,6 +31,9 @@ the Public Domain which can now be found in <_PDCLIB_config.h>, thanks.
 Rod Pemberton, for pointing out several flaws in early versions of PDCLib and
 giving other valuable hints, thanks.
 
+Brian Damgaard, for a very friendly exchange over the fine details of the
+Quicksort algorithm and its implementation in PDCLib, thanks.
+
 Everyone involved in the first, "public" attempt at PDCLib, for bearing with me
 when I restarted from scratch, thanks.
 
index c37760f546fa47a089b913cff22d47e084f7d13f..3e349fb683179a2adbe9553c24a447256d1dede5 100644 (file)
@@ -34,8 +34,11 @@ static inline void memswp( char * i, char * j, size_t size )
 #define PREPARE_STACK char * stack[STACKSIZE]; char * * stackptr = stack
 #define PUSH( base, limit ) stackptr[0] = base; stackptr[1] = limit; stackptr += 2
 #define POP( base, limit ) stackptr -= 2; base = stackptr[0]; limit = stackptr[1]
-/* TODO: This is platform-dependent */
-#define STACKSIZE 40
+/* TODO: Stack usage is log2( nmemb ) (minus what T shaves off the worst case).
+         Worst-case nmemb is platform dependent and should probably be 
+         configured through _PDCLIB_config.h.
+*/
+#define STACKSIZE 64
 
 void qsort( void * base, size_t nmemb, size_t size, int (*compar)( const void *, const void * ) )
 {