]> git.proxmox.com Git - mirror_edk2.git/blame - ShellPkg/Include/Library/SortLib.h
Update to consume CPU I/O 2 Protocol instead of Framework CPU I/O Protocol.
[mirror_edk2.git] / ShellPkg / Include / Library / SortLib.h
CommitLineData
4983ca93 1/** @file\r
125c2cf4 2 Library used for sorting and comparison routines.\r
4983ca93 3\r
a31bd33c 4Copyright (c) 2009, Intel Corporation<BR>\r
4983ca93 5All rights reserved. This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#if !defined(__SORT_LIB_H__)\r
16#define __SORT_LIB_H__\r
17\r
18/**\r
19 Prototype for comparison function for any 2 element types.\r
20\r
a31bd33c 21 @param[in] Buffer1 Pointer to first buffer.\r
22 @param[in] Buffer2 Pointer to second buffer.\r
4983ca93 23\r
a31bd33c 24 @retval 0 Buffer1 equal to Buffer2.\r
25 @return < 0 Buffer1 is less than Buffer2.\r
26 @return > 0 Buffer1 is greater than Buffer2.\r
4983ca93 27**/\r
28typedef\r
29INTN\r
30(EFIAPI *SORT_COMPARE)(\r
31 IN VOID *Buffer1,\r
32 IN VOID *Buffer2\r
33 );\r
34\r
35/**\r
36 Function to perform a Quick Sort on a buffer of comparable elements.\r
37\r
38 Each element must be equally sized.\r
39\r
a31bd33c 40 If BufferToSort is NULL, then ASSERT.\r
41 If CompareFunction is NULL, then ASSERT.\r
4983ca93 42\r
a31bd33c 43 If Count is < 2 then perform no action.\r
44 If Size is < 1 then perform no action.\r
4983ca93 45\r
a31bd33c 46 @param[in,out] BufferToSort On call a Buffer of (possibly sorted) elements\r
47 on return a buffer of sorted elements.\r
48 @param[in] Count The number of elements in the buffer to sort\r
49 @param[in] ElementSize Size of an element in bytes.\r
4983ca93 50 @param[in] CompareFunction The function to call to perform the comparison \r
a31bd33c 51 of any 2 elements.\r
4983ca93 52**/\r
53VOID\r
54EFIAPI\r
55PerformQuickSort (\r
56 IN OUT VOID *BufferToSort,\r
57 IN CONST UINTN Count,\r
58 IN CONST UINTN ElementSize,\r
59 IN SORT_COMPARE CompareFunction\r
60 );\r
61\r
125c2cf4 62\r
63/**\r
64 Function to compare 2 device paths for use as CompareFunction.\r
65\r
66 @param[in] Buffer1 pointer to Device Path to compare\r
67 @param[in] Buffer2 pointer to second DevicePath to compare\r
68\r
69 @retval 0 Buffer1 equal to Buffer2\r
70 @return < 0 Buffer1 is less than Buffer2\r
71 @return > 0 Buffer1 is greater than Buffer2 \r
72**/\r
73INTN\r
74DevicePathCompare (\r
75 IN VOID *Buffer1,\r
76 IN VOID *Buffer2\r
77 );\r
4983ca93 78#endif //__SORT_LIB_H__\r