2 Library used for sorting and comparison routines.
4 Copyright (c) 2009-2010, 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.
15 #if !defined(__SORT_LIB_H__)
16 #define __SORT_LIB_H__
19 Prototype for comparison function for any 2 element types.
21 @param[in] Buffer1 Pointer to first buffer.
22 @param[in] Buffer2 Pointer to second buffer.
24 @retval 0 Buffer1 equal to Buffer2.
25 @return < 0 Buffer1 is less than Buffer2.
26 @return > 0 Buffer1 is greater than Buffer2.
30 (EFIAPI
*SORT_COMPARE
)(
31 IN CONST VOID
*Buffer1
,
32 IN CONST VOID
*Buffer2
36 Function to perform a Quick Sort on a buffer of comparable elements.
38 Each element must be equally sized.
40 If BufferToSort is NULL, then ASSERT.
41 If CompareFunction is NULL, then ASSERT.
43 If Count is < 2 then perform no action.
44 If Size is < 1 then perform no action.
46 @param[in,out] BufferToSort On call a Buffer of (possibly sorted) elements
47 on return a buffer of sorted elements.
48 @param[in] Count The number of elements in the buffer to sort
49 @param[in] ElementSize Size of an element in bytes.
50 @param[in] CompareFunction The function to call to perform the comparison
56 IN OUT VOID
*BufferToSort
,
58 IN CONST UINTN ElementSize
,
59 IN SORT_COMPARE CompareFunction
64 Function to compare 2 device paths for use as CompareFunction.
66 @param[in] Buffer1 Pointer to Device Path to compare.
67 @param[in] Buffer2 Pointer to second DevicePath to compare.
69 @retval 0 Buffer1 equal to Buffer2.
70 @return < 0 Buffer1 is less than Buffer2.
71 @return > 0 Buffer1 is greater than Buffer2.
76 IN CONST VOID
*Buffer1
,
77 IN CONST VOID
*Buffer2
81 Function to compare 2 strings without regard to case of the characters.
83 @param[in] Buffer1 Pointer to String to compare (CHAR16**).
84 @param[in] Buffer2 Pointer to second String to compare (CHAR16**).
86 @retval 0 Buffer1 equal to Buffer2.
87 @return < 0 Buffer1 is less than Buffer2.
88 @return > 0 Buffer1 is greater than Buffer2.
93 IN CONST VOID
*Buffer1
,
94 IN CONST VOID
*Buffer2
97 #endif //__SORT_LIB_H__