// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element\r
// IE list is sorted left half, pivot element, sorted right half...\r
//\r
- QuickSortWorker(\r
- BufferToSort,\r
- NextSwapLocation,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
-\r
- QuickSortWorker(\r
- (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
- Count - NextSwapLocation - 1,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
+ if (NextSwapLocation >= 2) {\r
+ QuickSortWorker(\r
+ BufferToSort,\r
+ NextSwapLocation,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
\r
+ if ((Count - NextSwapLocation - 1) >= 2) {\r
+ QuickSortWorker(\r
+ (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
+ Count - NextSwapLocation - 1,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
return;\r
}\r
/**\r
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element\r
// IE list is sorted left half, pivot element, sorted right half...\r
//\r
- QuickSortWorker(\r
- BufferToSort,\r
- NextSwapLocation,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
+ if (NextSwapLocation >= 2) {\r
+ QuickSortWorker(\r
+ BufferToSort,\r
+ NextSwapLocation,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
\r
- QuickSortWorker(\r
- (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
- Count - NextSwapLocation - 1,\r
- ElementSize,\r
- CompareFunction,\r
- Buffer);\r
+ if ((Count - NextSwapLocation - 1) >= 2) {\r
+ QuickSortWorker(\r
+ (UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,\r
+ Count - NextSwapLocation - 1,\r
+ ElementSize,\r
+ CompareFunction,\r
+ Buffer);\r
+ }\r
\r
return;\r
}\r