TianoCore EDK2 master
Loading...
Searching...
No Matches
QuickSort.c File Reference
#include "BaseLibInternals.h"

Go to the source code of this file.

Functions

VOID EFIAPI QuickSort (IN OUT VOID *BufferToSort, IN CONST UINTN Count, IN CONST UINTN ElementSize, IN BASE_SORT_COMPARE CompareFunction, OUT VOID *BufferOneElement)
 

Detailed Description

Math worker functions.

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

Definition in file QuickSort.c.

Function Documentation

◆ QuickSort()

VOID EFIAPI QuickSort ( IN OUT VOID *  BufferToSort,
IN CONST UINTN  Count,
IN CONST UINTN  ElementSize,
IN BASE_SORT_COMPARE  CompareFunction,
OUT VOID *  BufferOneElement 
)

This function is identical to perform QuickSort, except that is uses the pre-allocated buffer so the in place sorting does not need to allocate and free buffers constantly.

Each element must be equal sized.

if BufferToSort is NULL, then ASSERT. if CompareFunction is NULL, then ASSERT. if BufferOneElement is NULL, then ASSERT. if ElementSize is < 1, then ASSERT.

if Count is < 2 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
[out]BufferOneElementCaller provided buffer whose size equals to ElementSize. It's used by QuickSort() for swapping in sorting.

Definition at line 36 of file QuickSort.c.