2 Library used for sorting and comparison routines.
4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #define __SORT_LIB_H__
13 Prototype for comparison function for any two element types.
15 @param[in] Buffer1 The pointer to first buffer.
16 @param[in] Buffer2 The pointer to second buffer.
18 @retval 0 Buffer1 equal to Buffer2.
19 @return <0 Buffer1 is less than Buffer2.
20 @return >0 Buffer1 is greater than Buffer2.
24 (EFIAPI
*SORT_COMPARE
)(
25 IN CONST VOID
*Buffer1
,
26 IN CONST VOID
*Buffer2
30 Function to perform a Quick Sort on a buffer of comparable elements.
32 Each element must be equally sized.
34 If BufferToSort is NULL, then ASSERT.
35 If CompareFunction is NULL, then ASSERT.
37 If Count is < 2 , then perform no action.
38 If Size is < 1 , then perform no action.
40 @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;
41 on return, a buffer of sorted elements.
42 @param[in] Count The number of elements in the buffer to sort.
43 @param[in] ElementSize The size of an element in bytes.
44 @param[in] CompareFunction The function to call to perform the comparison
50 IN OUT VOID
*BufferToSort
,
52 IN CONST UINTN ElementSize
,
53 IN SORT_COMPARE CompareFunction
57 Function to compare 2 device paths for use as CompareFunction.
59 @param[in] Buffer1 The pointer to Device Path to compare.
60 @param[in] Buffer2 The pointer to second DevicePath to compare.
62 @retval 0 Buffer1 equal to Buffer2.
63 @return < 0 Buffer1 is less than Buffer2.
64 @return > 0 Buffer1 is greater than Buffer2.
69 IN CONST VOID
*Buffer1
,
70 IN CONST VOID
*Buffer2
74 Function to compare 2 strings without regard to case of the characters.
76 @param[in] Buffer1 The pointer to String to compare (CHAR16**).
77 @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
79 @retval 0 Buffer1 equal to Buffer2.
80 @return < 0 Buffer1 is less than Buffer2.
81 @return > 0 Buffer1 is greater than Buffer2.
86 IN CONST VOID
*Buffer1
,
87 IN CONST VOID
*Buffer2
91 Function to compare 2 strings.
93 @param[in] Buffer1 The pointer to String to compare (CHAR16**).
94 @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
96 @retval 0 Buffer1 equal to Buffer2.
97 @return < 0 Buffer1 is less than Buffer2.
98 @return > 0 Buffer1 is greater than Buffer2.
103 IN CONST VOID
*Buffer1
,
104 IN CONST VOID
*Buffer2
107 #endif //__SORT_LIB_H__