fixed license header / copyright date on all files.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9810 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,14 +1,14 @@
|
||||
/** @file
|
||||
Library used for sorting routines.
|
||||
|
||||
Copyright (c) 2009, Intel Corporation<BR>
|
||||
All rights reserved. This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
Copyright (c) 2009-2010, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
@ -23,15 +23,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/SortLib.h>
|
||||
#include <Library/SortLib.h>
|
||||
|
||||
STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathToText = NULL;
|
||||
STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
|
||||
|
||||
/**
|
||||
Worker function for QuickSorting. This function is identical to PerformQuickSort,
|
||||
except that is uses the pre-allocated buffer so the in place sorting does not need to
|
||||
Worker function for QuickSorting. This function is identical to PerformQuickSort,
|
||||
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.
|
||||
@ -47,7 +47,7 @@ STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL;
|
||||
on return a buffer of sorted elements
|
||||
@param[in] Count the number of elements in the buffer to sort
|
||||
@param[in] ElementSize Size of an element in bytes
|
||||
@param[in] CompareFunction The function to call to perform the comparison
|
||||
@param[in] CompareFunction The function to call to perform the comparison
|
||||
of any 2 elements
|
||||
@param[in] Buffer Buffer of size ElementSize for use in swapping
|
||||
**/
|
||||
@ -69,7 +69,7 @@ QuickSortWorker (
|
||||
ASSERT(CompareFunction != NULL);
|
||||
ASSERT(Buffer != NULL);
|
||||
|
||||
if ( Count < 2
|
||||
if ( Count < 2
|
||||
|| ElementSize < 1
|
||||
){
|
||||
return;
|
||||
@ -87,7 +87,7 @@ QuickSortWorker (
|
||||
// and everything "right" are above it
|
||||
//
|
||||
for ( LoopCount = 0
|
||||
; LoopCount < Count -1
|
||||
; LoopCount < Count -1
|
||||
; LoopCount++
|
||||
){
|
||||
//
|
||||
@ -95,7 +95,7 @@ QuickSortWorker (
|
||||
//
|
||||
if (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),Pivot) <= 0){
|
||||
//
|
||||
// swap
|
||||
// swap
|
||||
//
|
||||
CopyMem (Buffer, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), ElementSize);
|
||||
CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), (UINT8*)BufferToSort+((LoopCount)*ElementSize), ElementSize);
|
||||
@ -103,7 +103,7 @@ QuickSortWorker (
|
||||
|
||||
//
|
||||
// increment NextSwapLocation
|
||||
//
|
||||
//
|
||||
NextSwapLocation++;
|
||||
}
|
||||
}
|
||||
@ -115,20 +115,20 @@ QuickSortWorker (
|
||||
CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, ElementSize);
|
||||
|
||||
//
|
||||
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
||||
// Now recurse on 2 paritial lists. neither of these will have the 'pivot' element
|
||||
// IE list is sorted left half, pivot element, sorted right half...
|
||||
//
|
||||
QuickSortWorker(
|
||||
BufferToSort,
|
||||
NextSwapLocation,
|
||||
ElementSize,
|
||||
BufferToSort,
|
||||
NextSwapLocation,
|
||||
ElementSize,
|
||||
CompareFunction,
|
||||
Buffer);
|
||||
|
||||
QuickSortWorker(
|
||||
(UINT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,
|
||||
Count - NextSwapLocation - 1,
|
||||
ElementSize,
|
||||
Count - NextSwapLocation - 1,
|
||||
ElementSize,
|
||||
CompareFunction,
|
||||
Buffer);
|
||||
|
||||
@ -149,7 +149,7 @@ QuickSortWorker (
|
||||
on return a buffer of sorted elements
|
||||
@param[in] Count the number of elements in the buffer to sort
|
||||
@param[in] ElementSize Size of an element in bytes
|
||||
@param[in] CompareFunction The function to call to perform the comparison
|
||||
@param[in] CompareFunction The function to call to perform the comparison
|
||||
of any 2 elements
|
||||
**/
|
||||
VOID
|
||||
@ -188,7 +188,7 @@ PerformQuickSort (
|
||||
|
||||
@retval 0 Buffer1 equal to Buffer2
|
||||
@return < 0 Buffer1 is less than Buffer2
|
||||
@return > 0 Buffer1 is greater than Buffer2
|
||||
@return > 0 Buffer1 is greater than Buffer2
|
||||
**/
|
||||
INTN
|
||||
DevicePathCompare (
|
||||
@ -202,7 +202,7 @@ DevicePathCompare (
|
||||
CHAR16 *TextPath2;
|
||||
EFI_STATUS Status;
|
||||
INTN RetVal;
|
||||
|
||||
|
||||
DevicePath1 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer1;
|
||||
DevicePath2 = *(EFI_DEVICE_PATH_PROTOCOL**)Buffer2;
|
||||
|
||||
@ -217,7 +217,7 @@ DevicePathCompare (
|
||||
if (DevicePath2 == NULL) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (mDevicePathToText == NULL) {
|
||||
Status = gBS->LocateProtocol(
|
||||
&gEfiDevicePathToTextProtocolGuid,
|
||||
@ -245,7 +245,7 @@ DevicePathCompare (
|
||||
DevicePath2,
|
||||
FALSE,
|
||||
FALSE);
|
||||
|
||||
|
||||
RetVal = mUnicodeCollation->StriColl(
|
||||
mUnicodeCollation,
|
||||
TextPath1,
|
||||
@ -265,7 +265,7 @@ DevicePathCompare (
|
||||
|
||||
@retval 0 Buffer1 equal to Buffer2.
|
||||
@return < 0 Buffer1 is less than Buffer2.
|
||||
@return > 0 Buffer1 is greater than Buffer2.
|
||||
@return > 0 Buffer1 is greater than Buffer2.
|
||||
**/
|
||||
INTN
|
||||
EFIAPI
|
||||
|
Reference in New Issue
Block a user