~ubuntu-branches/ubuntu/trusty/virtualbox-lts-xenial/trusty-proposed

« back to all changes in this revision

Viewing changes to src/VBox/Devices/EFI/Firmware/ShellPkg/Include/Library/SortLib.h

  • Committer: Package Import Robot
  • Author(s): Gianfranco Costamagna
  • Date: 2016-02-23 14:28:26 UTC
  • Revision ID: package-import@ubuntu.com-20160223142826-bdu69el2z6wa2a44
Tags: upstream-4.3.36-dfsg
ImportĀ upstreamĀ versionĀ 4.3.36-dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
  Library used for sorting and comparison routines.
 
3
 
 
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
 
9
 
 
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.
 
12
 
 
13
**/
 
14
 
 
15
#ifndef __SORT_LIB_H__
 
16
#define __SORT_LIB_H__
 
17
 
 
18
/**
 
19
  Prototype for comparison function for any two element types.
 
20
 
 
21
  @param[in] Buffer1                  The pointer to first buffer.
 
22
  @param[in] Buffer2                  The pointer to second buffer.
 
23
 
 
24
  @retval 0                           Buffer1 equal to Buffer2.
 
25
  @return <0                          Buffer1 is less than Buffer2.
 
26
  @return >0                          Buffer1 is greater than Buffer2.
 
27
**/
 
28
typedef
 
29
INTN
 
30
(EFIAPI *SORT_COMPARE)(
 
31
  IN CONST VOID                 *Buffer1,
 
32
  IN CONST VOID                 *Buffer2
 
33
  );
 
34
 
 
35
/**
 
36
  Function to perform a Quick Sort on a buffer of comparable elements.
 
37
 
 
38
  Each element must be equally sized.
 
39
 
 
40
  If BufferToSort is NULL, then ASSERT.
 
41
  If CompareFunction is NULL, then ASSERT.
 
42
 
 
43
  If Count is < 2 , then perform no action.
 
44
  If Size is < 1 , then perform no action.
 
45
 
 
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        The size of an element in bytes.
 
50
  @param[in]  CompareFunction    The function to call to perform the comparison
 
51
                                 of any two elements.
 
52
**/
 
53
VOID
 
54
EFIAPI
 
55
PerformQuickSort (
 
56
  IN OUT VOID                   *BufferToSort,
 
57
  IN CONST UINTN                Count,
 
58
  IN CONST UINTN                ElementSize,
 
59
  IN       SORT_COMPARE         CompareFunction
 
60
  );
 
61
 
 
62
 
 
63
/**
 
64
  Function to compare 2 device paths for use as CompareFunction.
 
65
 
 
66
  @param[in] Buffer1            The pointer to Device Path to compare.
 
67
  @param[in] Buffer2            The pointer to second DevicePath to compare.
 
68
 
 
69
  @retval 0                     Buffer1 equal to Buffer2.
 
70
  @return < 0                   Buffer1 is less than Buffer2.
 
71
  @return > 0                   Buffer1 is greater than Buffer2.
 
72
**/
 
73
INTN
 
74
EFIAPI
 
75
DevicePathCompare (
 
76
  IN  CONST VOID                *Buffer1,
 
77
  IN  CONST VOID                *Buffer2
 
78
  );
 
79
 
 
80
/**
 
81
  Function to compare 2 strings without regard to case of the characters.
 
82
 
 
83
  @param[in] Buffer1            The pointer to String to compare (CHAR16**).
 
84
  @param[in] Buffer2            The pointer to second String to compare (CHAR16**).
 
85
 
 
86
  @retval 0                     Buffer1 equal to Buffer2.
 
87
  @return < 0                   Buffer1 is less than Buffer2.
 
88
  @return > 0                   Buffer1 is greater than Buffer2.
 
89
**/
 
90
INTN
 
91
EFIAPI
 
92
StringNoCaseCompare (
 
93
  IN  CONST VOID                *Buffer1,
 
94
  IN  CONST VOID                *Buffer2
 
95
  );
 
96
 
 
97
/**
 
98
  Function to compare 2 strings.
 
99
 
 
100
  @param[in] Buffer1            The pointer to String to compare (CHAR16**).
 
101
  @param[in] Buffer2            The pointer to second String to compare (CHAR16**).
 
102
 
 
103
  @retval 0                     Buffer1 equal to Buffer2.
 
104
  @return < 0                   Buffer1 is less than Buffer2.
 
105
  @return > 0                   Buffer1 is greater than Buffer2.
 
106
**/
 
107
INTN
 
108
EFIAPI
 
109
StringCompare (
 
110
  IN  CONST VOID                *Buffer1,
 
111
  IN  CONST VOID                *Buffer2
 
112
  );
 
113
 
 
114
#endif //__SORT_LIB_H__