No need to sort arrays of 1 element.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10899 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -109,20 +109,23 @@ QuickSortWorker (
|
|||||||
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
||||||
// IE list is sorted left half, pivot element, sorted right half...
|
// IE list is sorted left half, pivot element, sorted right half...
|
||||||
//
|
//
|
||||||
|
if (NextSwapLocation >= 2) {
|
||||||
QuickSortWorker(
|
QuickSortWorker(
|
||||||
BufferToSort,
|
BufferToSort,
|
||||||
NextSwapLocation,
|
NextSwapLocation,
|
||||||
ElementSize,
|
ElementSize,
|
||||||
CompareFunction,
|
CompareFunction,
|
||||||
Buffer);
|
Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Count - NextSwapLocation - 1) >= 2) {
|
||||||
QuickSortWorker(
|
QuickSortWorker(
|
||||||
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
|
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
|
||||||
Count - NextSwapLocation - 1,
|
Count - NextSwapLocation - 1,
|
||||||
ElementSize,
|
ElementSize,
|
||||||
CompareFunction,
|
CompareFunction,
|
||||||
Buffer);
|
Buffer);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -118,19 +118,23 @@ QuickSortWorker (
|
|||||||
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
||||||
// IE list is sorted left half, pivot element, sorted right half...
|
// IE list is sorted left half, pivot element, sorted right half...
|
||||||
//
|
//
|
||||||
|
if (NextSwapLocation >= 2) {
|
||||||
QuickSortWorker(
|
QuickSortWorker(
|
||||||
BufferToSort,
|
BufferToSort,
|
||||||
NextSwapLocation,
|
NextSwapLocation,
|
||||||
ElementSize,
|
ElementSize,
|
||||||
CompareFunction,
|
CompareFunction,
|
||||||
Buffer);
|
Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((Count - NextSwapLocation - 1) >= 2) {
|
||||||
QuickSortWorker(
|
QuickSortWorker(
|
||||||
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
|
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
|
||||||
Count - NextSwapLocation - 1,
|
Count - NextSwapLocation - 1,
|
||||||
ElementSize,
|
ElementSize,
|
||||||
CompareFunction,
|
CompareFunction,
|
||||||
Buffer);
|
Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user