37 IN OUT VOID *BufferToSort,
41 OUT VOID *BufferOneElement
46 UINTN NextSwapLocation;
48 ASSERT (BufferToSort !=
NULL);
49 ASSERT (CompareFunction !=
NULL);
50 ASSERT (BufferOneElement !=
NULL);
51 ASSERT (ElementSize >= 1);
62 Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize));
68 for (LoopCount = 0; LoopCount < Count -1; LoopCount++) {
72 if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) {
76 CopyMem (BufferOneElement, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
77 CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize);
78 CopyMem ((UINT8 *)BufferToSort + ((LoopCount)*ElementSize), BufferOneElement, ElementSize);
90 CopyMem (BufferOneElement, Pivot, ElementSize);
91 CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
92 CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), BufferOneElement, ElementSize);
98 if (NextSwapLocation >= 2) {
108 if ((Count - NextSwapLocation - 1) >= 2) {
110 (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize,
111 Count - NextSwapLocation - 1,
INTN(EFIAPI * BASE_SORT_COMPARE)(IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID EFIAPI QuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN BASE_SORT_COMPARE CompareFunction, OUT VOID *BufferOneElement)