TianoCore EDK2 master
Loading...
Searching...
No Matches
SortLib.h File Reference

Go to the source code of this file.

Typedefs

typedef INTN(EFIAPI * SORT_COMPARE) (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
 

Functions

VOID EFIAPI PerformQuickSort (IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN SORT_COMPARE CompareFunction)
 
INTN EFIAPI DevicePathCompare (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
 
INTN EFIAPI StringNoCaseCompare (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
 
INTN EFIAPI StringCompare (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)
 

Detailed Description

Library used for sorting and comparison routines.

Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file SortLib.h.

Typedef Documentation

◆ SORT_COMPARE

typedef INTN(EFIAPI * SORT_COMPARE) (IN CONST VOID *Buffer1, IN CONST VOID *Buffer2)

Prototype for comparison function for any two element types.

Parameters
[in]Buffer1The pointer to first buffer.
[in]Buffer2The pointer to second buffer.
Return values
0Buffer1 equal to Buffer2.
Returns
<0 Buffer1 is less than Buffer2.
>0 Buffer1 is greater than Buffer2.

Definition at line 23 of file SortLib.h.

Function Documentation

◆ DevicePathCompare()

INTN EFIAPI DevicePathCompare ( IN CONST VOID *  Buffer1,
IN CONST VOID *  Buffer2 
)

Function to compare 2 device paths for use as CompareFunction.

Parameters
[in]Buffer1The pointer to Device Path to compare.
[in]Buffer2The pointer to second DevicePath to compare.
Return values
0Buffer1 equal to Buffer2.
Returns
< 0 Buffer1 is less than Buffer2.
> 0 Buffer1 is greater than Buffer2.

Not supported in Base version.

Parameters
[in]Buffer1Ignored.
[in]Buffer2Ignored.

ASSERT and return 0.

Function to compare 2 device paths for use in QuickSort.

Parameters
[in]Buffer1pointer to Device Path poiner to compare
[in]Buffer2pointer to second DevicePath pointer to compare
Return values
0Buffer1 equal to Buffer2
<0Buffer1 is less than Buffer2
>0Buffer1 is greater than Buffer2

Definition at line 73 of file BaseSortLib.c.

◆ PerformQuickSort()

VOID EFIAPI PerformQuickSort ( IN OUT VOID *  BufferToSort,
IN CONST UINTN  Count,
IN CONST UINTN  ElementSize,
IN SORT_COMPARE  CompareFunction 
)

Function to perform a Quick Sort on a buffer of comparable elements.

Each element must be equally sized.

If BufferToSort is NULL, then ASSERT. If CompareFunction is NULL, then ASSERT.

If Count is < 2 , then perform no action. If Size is < 1 , then perform no action.

Parameters
[in,out]BufferToSortOn call, a Buffer of (possibly sorted) elements; on return, a buffer of sorted elements.
[in]CountThe number of elements in the buffer to sort.
[in]ElementSizeThe size of an element in bytes.
[in]CompareFunctionThe function to call to perform the comparison of any two elements.

Function to perform a Quick Sort alogrithm on a buffer of comparable elements.

Each element must be equal sized.

if BufferToSort is NULL, then ASSERT. if CompareFunction is NULL, then ASSERT.

if Count is < 2 then perform no action. if Size is < 1 then perform no action.

Parameters
[in,out]BufferToSorton call a Buffer of (possibly sorted) elements on return a buffer of sorted elements
[in]Countthe number of elements in the buffer to sort
[in]ElementSizeSize of an element in bytes
[in]CompareFunctionThe function to call to perform the comparison of any 2 elements

Definition at line 36 of file BaseSortLib.c.

◆ StringCompare()

INTN EFIAPI StringCompare ( IN CONST VOID *  Buffer1,
IN CONST VOID *  Buffer2 
)

Function to compare 2 strings.

Parameters
[in]Buffer1The pointer to String to compare (CHAR16**).
[in]Buffer2The pointer to second String to compare (CHAR16**).
Return values
0Buffer1 equal to Buffer2.
Returns
< 0 Buffer1 is less than Buffer2.
> 0 Buffer1 is greater than Buffer2.

Not supported in Base version.

Parameters
[in]Buffer1Ignored.
[in]Buffer2Ignored.

ASSERT and return 0.

Function to compare 2 strings.

Parameters
[in]Buffer1Pointer to String to compare (CHAR16**).
[in]Buffer2Pointer to second String to compare (CHAR16**).
Return values
0Buffer1 equal to Buffer2.
<0Buffer1 is less than Buffer2.
>0Buffer1 is greater than Buffer2.

Definition at line 111 of file BaseSortLib.c.

◆ StringNoCaseCompare()

INTN EFIAPI StringNoCaseCompare ( IN CONST VOID *  Buffer1,
IN CONST VOID *  Buffer2 
)

Function to compare 2 strings without regard to case of the characters.

Parameters
[in]Buffer1The pointer to String to compare (CHAR16**).
[in]Buffer2The pointer to second String to compare (CHAR16**).
Return values
0Buffer1 equal to Buffer2.
Returns
< 0 Buffer1 is less than Buffer2.
> 0 Buffer1 is greater than Buffer2.

Not supported in Base version.

Parameters
[in]Buffer1Ignored.
[in]Buffer2Ignored.

ASSERT and return 0.

Function to compare 2 strings without regard to case of the characters.

Parameters
[in]Buffer1Pointer to String to compare.
[in]Buffer2Pointer to second String to compare.
Return values
0Buffer1 equal to Buffer2.
<0Buffer1 is less than Buffer2.
>0Buffer1 is greater than Buffer2.

Definition at line 92 of file BaseSortLib.c.