2 Library used for sorting and comparison routines.
4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #ifndef __SORT_LIB_H__
15 #define __SORT_LIB_H__
18 Prototype for comparison function for any two element types.
20 @param[in] Buffer1 The pointer to first buffer.
21 @param[in] Buffer2 The pointer to second buffer.
23 @retval 0 Buffer1 equal to Buffer2.
24 @return <0 Buffer1 is less than Buffer2.
25 @return >0 Buffer1 is greater than Buffer2.
29 (EFIAPI
*SORT_COMPARE
)(
30 IN CONST VOID
*Buffer1
,
31 IN CONST VOID
*Buffer2
35 Function to perform a Quick Sort on a buffer of comparable elements.
37 Each element must be equally sized.
39 If BufferToSort is NULL, then ASSERT.
40 If CompareFunction is NULL, then ASSERT.
42 If Count is < 2 , then perform no action.
43 If Size is < 1 , then perform no action.
45 @param[in, out] BufferToSort On call, a Buffer of (possibly sorted) elements;
46 on return, a buffer of sorted elements.
47 @param[in] Count The number of elements in the buffer to sort.
48 @param[in] ElementSize The size of an element in bytes.
49 @param[in] CompareFunction The function to call to perform the comparison
55 IN OUT VOID
*BufferToSort
,
57 IN CONST UINTN ElementSize
,
58 IN SORT_COMPARE CompareFunction
63 Function to compare 2 device paths for use as CompareFunction.
65 @param[in] Buffer1 The pointer to Device Path to compare.
66 @param[in] Buffer2 The pointer to second DevicePath to compare.
68 @retval 0 Buffer1 equal to Buffer2.
69 @return < 0 Buffer1 is less than Buffer2.
70 @return > 0 Buffer1 is greater than Buffer2.
75 IN CONST VOID
*Buffer1
,
76 IN CONST VOID
*Buffer2
80 Function to compare 2 strings without regard to case of the characters.
82 @param[in] Buffer1 The pointer to String to compare (CHAR16**).
83 @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
85 @retval 0 Buffer1 equal to Buffer2.
86 @return < 0 Buffer1 is less than Buffer2.
87 @return > 0 Buffer1 is greater than Buffer2.
92 IN CONST VOID
*Buffer1
,
93 IN CONST VOID
*Buffer2
97 Function to compare 2 strings.
99 @param[in] Buffer1 The pointer to String to compare (CHAR16**).
100 @param[in] Buffer2 The pointer to second String to compare (CHAR16**).
102 @retval 0 Buffer1 equal to Buffer2.
103 @return < 0 Buffer1 is less than Buffer2.
104 @return > 0 Buffer1 is greater than Buffer2.
109 IN CONST VOID
*Buffer1
,
110 IN CONST VOID
*Buffer2
113 #endif //__SORT_LIB_H__