]>
Commit | Line | Data |
---|---|---|
4983ca93 | 1 | /** @file\r |
125c2cf4 | 2 | Library used for sorting and comparison routines.\r |
4983ca93 | 3 | \r |
ae591c14 | 4 | Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>\r |
1e6e84c7 | 5 | This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
4983ca93 | 9 | \r |
1e6e84c7 | 10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
4983ca93 | 12 | \r |
13 | **/\r | |
a405b86d | 14 | #ifndef __SORT_LIB_H__\r |
4983ca93 | 15 | #define __SORT_LIB_H__\r |
16 | \r | |
17 | /**\r | |
a405b86d | 18 | Prototype for comparison function for any two element types.\r |
4983ca93 | 19 | \r |
a405b86d | 20 | @param[in] Buffer1 The pointer to first buffer.\r |
21 | @param[in] Buffer2 The pointer to second buffer.\r | |
4983ca93 | 22 | \r |
a31bd33c | 23 | @retval 0 Buffer1 equal to Buffer2.\r |
a405b86d | 24 | @return <0 Buffer1 is less than Buffer2.\r |
25 | @return >0 Buffer1 is greater than Buffer2.\r | |
4983ca93 | 26 | **/\r |
27 | typedef\r | |
28 | INTN\r | |
29 | (EFIAPI *SORT_COMPARE)(\r | |
b3011f40 | 30 | IN CONST VOID *Buffer1,\r |
31 | IN CONST VOID *Buffer2\r | |
4983ca93 | 32 | );\r |
33 | \r | |
34 | /**\r | |
35 | Function to perform a Quick Sort on a buffer of comparable elements.\r | |
36 | \r | |
37 | Each element must be equally sized.\r | |
38 | \r | |
a31bd33c | 39 | If BufferToSort is NULL, then ASSERT.\r |
40 | If CompareFunction is NULL, then ASSERT.\r | |
4983ca93 | 41 | \r |
a405b86d | 42 | If Count is < 2 , then perform no action.\r |
43 | If Size is < 1 , then perform no action.\r | |
4983ca93 | 44 | \r |
4ff7e37b ED |
45 | @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;\r |
46 | on return, a buffer of sorted elements.\r | |
47 | @param[in] Count The number of elements in the buffer to sort.\r | |
48 | @param[in] ElementSize The size of an element in bytes.\r | |
49 | @param[in] CompareFunction The function to call to perform the comparison\r | |
50 | of any two elements.\r | |
4983ca93 | 51 | **/\r |
52 | VOID\r | |
53 | EFIAPI\r | |
54 | PerformQuickSort (\r | |
b3011f40 | 55 | IN OUT VOID *BufferToSort,\r |
56 | IN CONST UINTN Count,\r | |
57 | IN CONST UINTN ElementSize,\r | |
58 | IN SORT_COMPARE CompareFunction\r | |
4983ca93 | 59 | );\r |
60 | \r | |
125c2cf4 | 61 | \r |
62 | /**\r | |
63 | Function to compare 2 device paths for use as CompareFunction.\r | |
64 | \r | |
a405b86d | 65 | @param[in] Buffer1 The pointer to Device Path to compare.\r |
66 | @param[in] Buffer2 The pointer to second DevicePath to compare.\r | |
125c2cf4 | 67 | \r |
11d2decf | 68 | @retval 0 Buffer1 equal to Buffer2.\r |
69 | @return < 0 Buffer1 is less than Buffer2.\r | |
1e6e84c7 | 70 | @return > 0 Buffer1 is greater than Buffer2.\r |
125c2cf4 | 71 | **/\r |
72 | INTN\r | |
11d2decf | 73 | EFIAPI\r |
125c2cf4 | 74 | DevicePathCompare (\r |
b3011f40 | 75 | IN CONST VOID *Buffer1,\r |
76 | IN CONST VOID *Buffer2\r | |
125c2cf4 | 77 | );\r |
11d2decf | 78 | \r |
79 | /**\r | |
80 | Function to compare 2 strings without regard to case of the characters.\r | |
81 | \r | |
a405b86d | 82 | @param[in] Buffer1 The pointer to String to compare (CHAR16**).\r |
83 | @param[in] Buffer2 The pointer to second String to compare (CHAR16**).\r | |
11d2decf | 84 | \r |
85 | @retval 0 Buffer1 equal to Buffer2.\r | |
86 | @return < 0 Buffer1 is less than Buffer2.\r | |
1e6e84c7 | 87 | @return > 0 Buffer1 is greater than Buffer2.\r |
11d2decf | 88 | **/\r |
89 | INTN\r | |
90 | EFIAPI\r | |
91 | StringNoCaseCompare (\r | |
b3011f40 | 92 | IN CONST VOID *Buffer1,\r |
93 | IN CONST VOID *Buffer2\r | |
11d2decf | 94 | );\r |
95 | \r | |
a405b86d | 96 | /**\r |
97 | Function to compare 2 strings.\r | |
98 | \r | |
99 | @param[in] Buffer1 The pointer to String to compare (CHAR16**).\r | |
100 | @param[in] Buffer2 The pointer to second String to compare (CHAR16**).\r | |
101 | \r | |
102 | @retval 0 Buffer1 equal to Buffer2.\r | |
103 | @return < 0 Buffer1 is less than Buffer2.\r | |
104 | @return > 0 Buffer1 is greater than Buffer2.\r | |
105 | **/\r | |
106 | INTN\r | |
107 | EFIAPI\r | |
108 | StringCompare (\r | |
109 | IN CONST VOID *Buffer1,\r | |
110 | IN CONST VOID *Buffer2\r | |
111 | );\r | |
112 | \r | |
4983ca93 | 113 | #endif //__SORT_LIB_H__\r |