27 IN OUT VOID *BufferToSort,
30 IN SORT_COMPARE CompareFunction,
36 UINTN NextSwapLocation;
38 ASSERT (BufferToSort !=
NULL);
39 ASSERT (CompareFunction !=
NULL);
40 ASSERT (Buffer !=
NULL);
42 if ((Count < 2) || (ElementSize < 1)) {
51 Pivot = ((UINT8 *)BufferToSort + ((Count - 1) * ElementSize));
57 for (LoopCount = 0; LoopCount < Count - 1; LoopCount++) {
61 if (CompareFunction ((VOID *)((UINT8 *)BufferToSort + ((LoopCount) * ElementSize)), Pivot) <= 0) {
65 CopyMem (Buffer, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
66 CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), (UINT8 *)BufferToSort + ((LoopCount) * ElementSize), ElementSize);
67 CopyMem ((UINT8 *)BufferToSort + ((LoopCount) * ElementSize), Buffer, ElementSize);
79 CopyMem (Buffer, Pivot, ElementSize);
80 CopyMem (Pivot, (UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), ElementSize);
81 CopyMem ((UINT8 *)BufferToSort + (NextSwapLocation * ElementSize), Buffer, ElementSize);
96 (UINT8 *)BufferToSort + (NextSwapLocation + 1) * ElementSize,
97 Count - NextSwapLocation - 1,
123 for (save =
NULL; ; ++str) {
149 Val = tolower (*s1) - tolower (*s2);
201 for (Index = 0; Index < 32; Index++) {
206 Map[*s2 >> 3] |= (1 << (*s2 & 7));
212 while (Map[*s1 >> 3] & (1 << (*s1 & 7))) {
235 for (Index = 0; Index < 32; Index++) {
240 Map[*s2 >> 3] |= (1 << (*s2 & 7));
247 while (!(Map[*s1 >> 3] & (1 << (*s1 & 7)))) {
258 const char *strSource
268 const char *strSource,
272 UINTN DestMax = MAX_STRING_SIZE;
274 if (count < MAX_STRING_SIZE) {
277 count = MAX_STRING_SIZE-1;
298 return ((
'0' <= (c)) && ((c) <=
'9'));
310 return (((
'0' <= (c)) && ((c) <=
'9')) ||
311 ((
'a' <= (c)) && ((c) <=
'f')) ||
312 ((
'A' <= (c)) && ((c) <=
'F')));
336 return (((
'0' <= (c)) && ((c) <=
'9')) ||
337 ((
'a' <= (c)) && ((c) <=
'z')) ||
338 ((
'A' <= (c)) && ((c) <=
'Z')));
350 return ((
'A' <= (c)) && ((c) <=
'Z'));
393 if ((
'A' <= (c)) && ((c) <=
'Z')) {
394 return (c - (
'A' -
'a'));
410 int ( *compare )(
const void *,
const void *)
415 ASSERT (base !=
NULL);
416 ASSERT (compare !=
NULL);
421 Buffer = malloc (width);
422 ASSERT (Buffer !=
NULL);
427 QuickSortWorker (base, (
UINTN)num, (
UINTN)width, (SORT_COMPARE)compare, Buffer);
486(EFIAPI *NoReturnFuncPtr)(
504 NoReturnFuncPtr NoReturnFunc;
506 NoReturnFunc = (NoReturnFuncPtr)NopFunction;
RETURN_STATUS EFIAPI AsciiStrnCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source, IN UINTN Length)
UINTN EFIAPI AsciiStrnSizeS(IN CONST CHAR8 *String, IN UINTN MaxSize)
RETURN_STATUS EFIAPI AsciiStrCpyS(OUT CHAR8 *Destination, IN UINTN DestMax, IN CONST CHAR8 *Source)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
unsigned long long UINT64 __attribute__((aligned(8)))