TianoCore EDK2 master
Loading...
Searching...
No Matches
ShellSortTestApp.c
Go to the documentation of this file.
1
9#include <Uefi.h>
10#include <Library/UefiLib.h>
11#include <Library/DebugLib.h>
13#include <Library/SortLib.h>
14
25INTN
26EFIAPI
28 CONST VOID *b1,
29 CONST VOID *b2
30 )
31{
32 if (*(INTN *)b1 == *(INTN *)b2) {
33 return (0);
34 }
35
36 if (*(INTN *)b1 < *(INTN *)b2) {
37 return (-1);
38 }
39
40 return (1);
41}
42
57INTN
58EFIAPI
60 IN UINTN Argc,
61 IN CHAR16 **Argv
62 )
63{
64 INTN Array[10];
65
66 Array[0] = 2;
67 Array[1] = 3;
68 Array[2] = 4;
69 Array[3] = 1;
70 Array[4] = 5;
71 Array[5] = 6;
72 Array[6] = 7;
73 Array[7] = 8;
74 Array[8] = 1;
75 Array[9] = 5;
76
77 Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
78 PerformQuickSort (Array, 10, sizeof (INTN), Test);
79 Print (L"POST-SORT\r\n");
80 Print (L"Array = %d, %d, %d, %d, %d, %d, %d, %d, %d, %d\r\n", Array[0], Array[1], Array[2], Array[3], Array[4], Array[5], Array[6], Array[7], Array[8], Array[9]);
81 return 0;
82}
UINT64 UINTN
INT64 INTN
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
INTN EFIAPI Test(CONST VOID *b1, CONST VOID *b2)
INTN EFIAPI ShellAppMain(IN UINTN Argc, IN CHAR16 **Argv)
VOID EFIAPI PerformQuickSort(IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
Definition: BaseSortLib.c:36
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
Definition: UefiLibPrint.c:113