4 ** 1998.12.09, Ullrich von Bassewitz
5 ** 2015-06-21, Greg King
14 static void QuickSort (register unsigned char* Base, int Lo, int Hi,
16 int __fastcall__ (* Compare) (const void*, const void*))
17 /* Internal recursive function. Works with ints, but this shouldn't be
28 while (I <= J && Compare (Base + Lo, Base + I) >= 0) {
31 while (I <= J && Compare (Base + Lo, Base + J) < 0) {
35 _swap (Base + I, Base + J, Size);
41 _swap (Base + J, Base + Lo, Size);
43 if (((unsigned) J) * 2 > (Hi + Lo)) {
44 QuickSort (Base, J + Size, Hi, Size, Compare);
47 QuickSort (Base, Lo, J - Size, Size, Compare);
55 void __fastcall__ qsort (void* base, size_t nmemb, size_t size,
56 int __fastcall__ (* compare) (const void*, const void*))
57 /* Quicksort implementation */
60 QuickSort (base, 0, (nmemb-1) * size, size, compare);