From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.4169.1634609351192905786 for ; Mon, 18 Oct 2021 19:09:11 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=NT8X2O2V; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: ianx.kuo@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10141"; a="215331528" X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="215331528" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2021 19:09:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,383,1624345200"; d="scan'208";a="443698226" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga006.jf.intel.com with ESMTP; 18 Oct 2021 19:09:10 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Mon, 18 Oct 2021 19:09:09 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Mon, 18 Oct 2021 19:09:09 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Mon, 18 Oct 2021 19:09:08 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HGC2fpAOdPwFs8DWFBFacSLWrguG59yhjUJZgCmgjQl7qjEEae8Dm/pZgJaaI91s8mYELevw3wdQeA7/bAFO8dpg4/jPVD1b7PeXvZDyxFSgg4/DpaASuqBigdna0PV5OJO+eGYhUp0JB36eIOMyZL4H8vt4u2zJ3dIErboW1w7kDFxYm+xL0CW4FbOVWHMYoMy1yg3g7/wbgnqq2r0GvprTHRp9e+phbXiusXiZl+ZTsHi4yYv+EsPfpResk03M5ptF7Z7n+dPgL0YQfehxlp6AzIQ0TayA4njKRB1VdsA37SzzTaavlyS/BrgKe7eGjlWcJD7CMR8dIq/TbUmIUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oC2z0rAQrk9doweR8wN2iFgv9PQWKPE/XEsGgYnyvTs=; b=OmaBhFsRyyGivpx1429YauWDGKhomvTHzdDwauiQIKvZBEwqpOafnUQOpcAgCuvlr5kX4PWJ0VSibMu7474z0EDzKhWTViowlpvL2eLfNCcZ5OaYKEBUO0Jd2K7/MJODjVCe/Lr7Q59JMOAuEspmqn3wpxmVU139qgcoySyw2XKntvuOaIIEnIbb1iZTik8rBjJ4iiu3ToZGKeX6wpmBkbhQ6Q0xwK3vKJQR5xzhcpg+Q1HL67CIoMBNGfkBIl92WPsx+gj6D4Tnl2DX/vkNPukP3ncQwLP+uVcAVYeq8CEXrqbNzBrusl3EPcJhMqYZ2DeqWgpFDDqC/C7IRTHP6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oC2z0rAQrk9doweR8wN2iFgv9PQWKPE/XEsGgYnyvTs=; b=NT8X2O2VJOWG+MBkNuOr/DL4mdoNM94GYLuWu2GAfjq1N6bGff6MmysX7y+QGyLeV+/ZWdr/N6TUoYriasr75+5zRiRZ+EiIF0oVmLXle1bf+bqx0o6mVRV3fkWQOb8EkE6mIr/jGSB3fhFDIdMCWAHUDeiqj49lM0jdDWQbwEc= Received: from PH0PR11MB5174.namprd11.prod.outlook.com (2603:10b6:510:3b::12) by PH0PR11MB4981.namprd11.prod.outlook.com (2603:10b6:510:39::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 02:09:07 +0000 Received: from PH0PR11MB5174.namprd11.prod.outlook.com ([fe80::4435:90ac:24fe:b6a6]) by PH0PR11MB5174.namprd11.prod.outlook.com ([fe80::4435:90ac:24fe:b6a6%6]) with mapi id 15.20.4608.018; Tue, 19 Oct 2021 02:09:07 +0000 From: "IanX Kuo" To: "devel@edk2.groups.io" , "Kuo, IanX" , Liming Gao CC: "Chan, Amy" , "Ni, Ray" , "Wang, Jian J" Subject: Re: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib Thread-Topic: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib Thread-Index: AQHXw9epnRIYdveiEkSf37x+PeBrUavZlMXA Date: Tue, 19 Oct 2021 02:09:07 +0000 Message-ID: References: <20211018042127.1306-1-ianx.kuo@intel.com> <16AF0531824632DE.13161@groups.io> In-Reply-To: <16AF0531824632DE.13161@groups.io> Accept-Language: en-AS, zh-TW, en-US X-Mentions: gaoliming@byosoft.com.cn X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd10e2bb-8203-45a5-906b-08d992a56ead x-ms-traffictypediagnostic: PH0PR11MB4981: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RqB7O5gSvKgvP6Dyx6TgnzSvTZXJzOv7+/j2nMSZSbknmERx579n4sbvE+k1uR2gblx9A9bKoXzi1dyhX3eSfaqntxCbill0mcz8KkJnXjd4V0jDg/UN1DDiGZvi7OozkWU2grLyC+nLiQxwd76XNHmLpEskeA5U3o38OtD2nIOdEbrCOdmmIJzcy9ptEarsChNuf3rfKPD7yP6tZfbxBgIa1aAu6dUP5RjnnEgmKA0BkTa1nHpyz1eN06t1mo1bWyWys3RXGphAKFruraqa8HaVThv9K8tnBuprrPJ+yrsZVoyZ7AYyv0G4Wtv5sq7C3q8iSEae960UgFsGUJqVcRsiXqxUfv248TW/takyLYhsmQd1I8vyuwhgW1fRTPVx7/tHs3pw+CcswPXoeFykdZ5vciTSLBM/Pqi72Gjgl07ZUPphJTeM30TTR6dE3iF9WJ7etYc0GtDaQmLHFQy41pktLxTzNSQSRBzMRFJE1TDVShaUeol2ptM5yO3eTkNVA7HfSVSHI8eyO3JZmLI66yju5rA0qFQxtSZwuLxQhnz6K2vC6jYNmIroiFsh48k40JbLT5TdgiTcO5tlreZ/ay9HMKgbXZYreVKgyWX8BVEBvDGGeBq/VUOVZq0qOlKFVvZHyZhWbK83PeC1UpMdFqj+Z5N57/LdH53PjHiybTak2ZGZVUlJjd9SXNuiFioRrLJzCvJm6acdHMbwIAVRV2K1EIHfDqKLajxdcuBcKZhoO/b5EjdyI2pxiVBakI649LDXsMotCUUU4CzZz7QUUxHt0AQriiq90BcemFZSWYGuoTNl31SOsZ/QJA2blHCCShLJ4zBXo5uExPNlMKnBUw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5174.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(38100700002)(966005)(107886003)(508600001)(8676002)(4326008)(33656002)(66946007)(66446008)(66556008)(52536014)(316002)(38070700005)(122000001)(6506007)(64756008)(66476007)(83380400001)(26005)(8936002)(76116006)(186003)(2906002)(7696005)(5660300002)(55016002)(9686003)(53546011)(86362001)(82960400001)(71200400001)(110136005)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?phYeViUDwd+1Bw+0fPUUr+6SvOXwnr0WudDHArDPMViFSaAV3KLSoDWDSfVo?= =?us-ascii?Q?PszygQWKmeo+2ZjB9RZjQ7QuFzbxt8/mCJm8nsz+5tPRvO36IfRpxf2ucxel?= =?us-ascii?Q?K7WaUagdlPCLX+pMoOuR1Pw0spO5bMNKUxkQNakk2J/J0D6M/g+dIEqA2xZJ?= =?us-ascii?Q?yMLrkfw9AA3G/mAQStka6Ek0agZf/oRL9UUS/Aw0NcFNjcsj+dL+VUw9P7G2?= =?us-ascii?Q?nb1mnt3VIAAbXecRMFkFykYZMVtbPfSRypkEBOYwRJo3noKmb/RImuVHDP1f?= =?us-ascii?Q?jkgqYPalAke8IQSgueLvI1yt/Z4WaVQrpP2p4y7o6ruojaV3AgDtyH7mep8d?= =?us-ascii?Q?9M/cphf1i4KIjqdp6yJBAeO3N9UJP8kPDg0qyr1l6gJevBpsZ0Tixbtmtvcl?= =?us-ascii?Q?VPSXOyN7iMIqSd8L8g/C+38K1yjl38TMsE565duksLt8SGasQaNkAru1s5K4?= =?us-ascii?Q?fd3TLaeLBUYJ5s4E3jyW2+ZHCuGWdH74Cjey+V36dUJxatUVePIpQ4rvpzvk?= =?us-ascii?Q?WJBZftCe7IextHekAnB+pGeaZNrpMZgDfmuOMftcgxSvKfUtAlpd5idtt4J5?= =?us-ascii?Q?yzCUJCkBDRcKL+2IOs9NRoqC34OrCRS8SAuHCcHms3RvfvRO7bibJ7U3xUp6?= =?us-ascii?Q?11wr97rPs5NjNTtifEjoKHabvzAiV7SsaHk4qltPb4eulVO1BgvPdYsWu/d0?= =?us-ascii?Q?IkZFD3imvGP7a5HCE5p7N6g6MKyry+f+trXu3A76mFYCtQAyB3NCdDHzyzq1?= =?us-ascii?Q?bmVX3S70bTaFvz2jWetcUY5vIPOJP62kj3A2dgVTyYkld9ny+mvwCaK1gh9E?= =?us-ascii?Q?xSAi3XsFnZvunCHczrpITjBpBZ023uASVRvyC77id+V/eVirkrjqo+pcwSFQ?= =?us-ascii?Q?5k6OLzY34N1qyaB0M+JV47UfMVNXSCPeF5KEccsysJGiVaFYjIwGY8AduIBO?= =?us-ascii?Q?mnSHq+VRGjc9dJaLvu9l+BQNPRzeYmkuTJSuFipif7NYyb9sHag8VptriSbc?= =?us-ascii?Q?13ksR5cmEpTsbwgAMuPts316yfH5vEReEh6i/97pegdtxghvKWdxlTwoLnVs?= =?us-ascii?Q?07v81vimhveW0cbOzcVJF7k5Q35V3VP2Pt/PIf/pL8vMjpqUYpruIYJLZnhZ?= =?us-ascii?Q?c/15CZvRdYlqcXwjPsvNPVeKlNvA49XkXXxWclLI3eMRSvMd8Sw/MF1izSy1?= =?us-ascii?Q?kQs1oZDyyxLHEf3zZunVSWbT4spziImH5lH7U/4hiYeR63NQCVvqqFBSGHL9?= =?us-ascii?Q?PLgArbPpMP/mrc2gl+pf9aC4Xg+NCl2dX2OTosUJNmSFN3XhZxNCJxTgYS1S?= =?us-ascii?Q?LrH9i7tgxKzB8+JPMzHm3MT/?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5174.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd10e2bb-8203-45a5-906b-08d992a56ead X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Oct 2021 02:09:07.2757 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: J9UI++AdvrkPHuyod5K3+Z8WrgGSZHaHV3uwigwX62473oURnUuPQD49z6qKgk4NgHWvnF5sk0+FUY8PbGGppw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4981 Return-Path: ianx.kuo@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable @Liming Gao Sorry to bother you. May I get your help for review by again ? Thanks, Ian Kuo -----Original Message----- From: devel@edk2.groups.io On Behalf Of IanX Kuo Sent: Monday, October 18, 2021 12:21 PM To: devel@edk2.groups.io Cc: Chan, Amy ; Ni, Ray ; Kuo, IanX <= ianx.kuo@intel.com>; Wang, Jian J ; Liming Gao Subject: [edk2-devel] [PATCH v6 1/3] MdeModulePkg/SortLib: Add QuickSort fu= nction on BaseLib From: IanX Kuo REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3675 Use QuickSort instead of QuickSortWorker Cc: Ray Ni Cc: Jian J Wang Cc: Liming Gao Signed-off-by: IanX Kuo --- .../Library/BaseSortLib/BaseSortLib.c | 115 +---------------- .../Library/UefiSortLib/UefiSortLib.c | 116 +----------------- 2 files changed, 8 insertions(+), 223 deletions(-) diff --git a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c b/MdeModulePkg/= Library/BaseSortLib/BaseSortLib.c index a12c7bc0ec..0903943ee4 100644 --- a/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c +++ b/MdeModulePkg/Library/BaseSortLib/BaseSortLib.c @@ -1,7 +1,7 @@ /** @file Library used for sorting routines. - Copyright (c) 2009 - 201= 8, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2021= , Intel Corporation. All rights reserved.
SPDX-License-Identifier: B= SD-2-Clause-Patent **/@@ -13,114 +13,6 @@ #include #include -/**= - Worker function for QuickSorting. This function is identical to Perform= QuickSort,- except that is uses the pre-allocated buffer so the in place s= orting does not need to- allocate and free buffers constantly.-- Each ele= ment must be equal sized.-- if BufferToSort is NULL, then ASSERT.- if Com= pareFunction is NULL, then ASSERT.- if Buffer is NULL, then ASSERT.-- if = Count is < 2 then perform no action.- if Size is < 1 then perform no actio= n.-- @param[in, out] BufferToSort on call a Buffer of (possibly sorted) = elements- on return a buffer of sorted elem= ents- @param[in] Count the number of elements in the buffer = to sort- @param[in] ElementSize Size of an element in bytes- @par= am[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-**/-VOID-EFIAPI-Quic= kSortWorker (- IN OUT VOID *BufferToSort,- IN C= ONST UINTN Count,- IN CONST UINTN = ElementSize,- IN SORT_COMPARE CompareFunction,= - IN VOID *Buffer- )-{- VOID *Pivot= ;- UINTN LoopCount;- UINTN NextSwapLocation;-- ASSERT(Buffer= ToSort !=3D NULL);- ASSERT(CompareFunction !=3D NULL);- ASSERT(Buffe= r !=3D NULL);-- if ( Count < 2- || ElementSize < 1- ){- return;-= }-- NextSwapLocation =3D 0;-- //- // pick a pivot (we choose last elem= ent)- //- Pivot =3D ((UINT8*)BufferToSort+((Count-1)*ElementSize));-- //= - // Now get the pivot such that all on "left" are below it- // and every= thing "right" are above it- //- for ( LoopCount =3D 0- ; LoopCount <= Count -1- ; LoopCount++- ){- //- // if the element is less = than the pivot- //- if (CompareFunction((VOID*)((UINT8*)BufferToSort+= ((LoopCount)*ElementSize)),Pivot) <=3D 0){- //- // swap- //-= CopyMem (Buffer, (UINT8*)BufferToSort+(NextSwapLocation*ElementSize),= ElementSize);- CopyMem ((UINT8*)BufferToSort+(NextSwapLocation*Elemen= tSize), (UINT8*)BufferToSort+((LoopCount)*ElementSize), ElementSize);- = CopyMem ((UINT8*)BufferToSort+((LoopCount)*ElementSize), Buffer, ElementSi= ze);-- //- // increment NextSwapLocation- //- NextSwapL= ocation++;- }- }- //- // swap pivot to it's final position (NextSwapL= ocaiton)- //- CopyMem (Buffer, Pivot, ElementSize);- CopyMem (Pivot, (UI= NT8*)BufferToSort+(NextSwapLocation*ElementSize), ElementSize);- CopyMem (= (UINT8*)BufferToSort+(NextSwapLocation*ElementSize), Buffer, ElementSize);-= - //- // Now recurse on 2 paritial lists. neither of these will have the= 'pivot' element- // IE list is sorted left half, pivot element, sorted ri= ght half...- //- if (NextSwapLocation >=3D 2) {- QuickSortWorker(- = BufferToSort,- NextSwapLocation,- ElementSize,- CompareFun= ction,- Buffer);- }-- if ((Count - NextSwapLocation - 1) >=3D 2) {- = QuickSortWorker(- (UINT8 *)BufferToSort + (NextSwapLocation+1) * El= ementSize,- Count - NextSwapLocation - 1,- ElementSize,- Com= pareFunction,- Buffer);- }- return;-} /** Function to perform a Qu= ick Sort alogrithm on a buffer of comparable elements. @@ -156,12 +48,13 @@= PerformQuickSort ( Buffer =3D AllocateZeroPool(ElementSize); ASSERT(Buffer !=3D NULL); - = QuickSortWorker(+ QuickSort ( BufferToSort, Count, ElementSiz= e, CompareFunction,- Buffer);+ Buffer+ ); FreePool(Buffer);= return;diff --git a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c b/Mde= ModulePkg/Library/UefiSortLib/UefiSortLib.c index 46dc443638..29d8735c22 100644 --- a/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c +++ b/MdeModulePkg/Library/UefiSortLib/UefiSortLib.c @@ -1,7 +1,7 @@ /** @file Library used for sorting routines. - Copyright (c) 2009 - 201= 4, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2021= , Intel Corporation. All rights reserved.
SPDX-License-Identifier: B= SD-2-Clause-Patent **/@@ -29,115 +29,6 @@ STATIC EFI_UNICODE_COLLATION_PRO= TOCOL *mUnicodeCollation =3D NULL; } \ } -/**- Worker function for Quick= Sorting. This function is identical to PerformQuickSort,- except that is = uses the pre-allocated buffer so the in place sorting does not need to- al= locate and free buffers constantly.-- Each element must be equal sized.-- = if BufferToSort is NULL, then ASSERT.- if CompareFunction is NULL, then A= SSERT.- if Buffer is NULL, then ASSERT.-- if Count is < 2 then perform no= action.- if Size is < 1 then perform no action.-- @param[in, out] Buffer= ToSort on call a Buffer of (possibly sorted) elements- = on return a buffer of sorted elements- @param[in] Count = the number of elements in the buffer to sort- @param[in] Element= Size Size of an element in bytes- @param[in] CompareFunction T= he function to call to perform the comparison- = of any 2 elements- @param[in] Buffer Buffer of size Eleme= ntSize for use in swapping-**/-VOID-EFIAPI-QuickSortWorker (- IN OUT VOID = *BufferToSort,- IN CONST UINTN = Count,- IN CONST UINTN ElementSize,- IN = SORT_COMPARE CompareFunction,- IN VOID = *Buffer- )-{- VOID *Pivot;- UINTN LoopCount;- = UINTN NextSwapLocation;-- ASSERT(BufferToSort !=3D NULL);- ASS= ERT(CompareFunction !=3D NULL);- ASSERT(Buffer !=3D NULL);-- if ( Count= < 2- || ElementSize < 1- ){- return;- }-- NextSwapLocation =3D = 0;-- //- // pick a pivot (we choose last element)- //- Pivot =3D ((UINT= 8*)BufferToSort+((Count-1)*ElementSize));-- //- // Now get the pivot such= that all on "left" are below it- // and everything "right" are above it- = //- for ( LoopCount =3D 0- ; LoopCount < Count -1- ; LoopCount+= +- ){- //- // if the element is less than the pivot- //- if= (CompareFunction((VOID*)((UINT8*)BufferToSort+((LoopCount)*ElementSize)),P= ivot) <=3D 0){- //- // swap- //- CopyMem (Buffer, (UINT= 8*)BufferToSort+(NextSwapLocation*ElementSize), ElementSize);- CopyMem= ((UINT8*)BufferToSort+(NextSwapLocation*ElementSize), (UINT8*)BufferToSort= +((LoopCount)*ElementSize), ElementSize);- CopyMem ((UINT8*)BufferToSo= rt+((LoopCount)*ElementSize), Buffer, ElementSize);-- //- // incr= ement NextSwapLocation- //- NextSwapLocation++;- }- }- //- = // swap pivot to it's final position (NextSwapLocaiton)- //- CopyMem (Buf= fer, Pivot, ElementSize);- CopyMem (Pivot, (UINT8*)BufferToSort+(NextSwapL= ocation*ElementSize), ElementSize);- CopyMem ((UINT8*)BufferToSort+(NextSw= apLocation*ElementSize), Buffer, ElementSize);-- //- // Now recurse on 2 = paritial lists. neither of these will have the 'pivot' element- // IE lis= t is sorted left half, pivot element, sorted right half...- //- if (NextS= wapLocation >=3D 2) {- QuickSortWorker(- BufferToSort,- NextSw= apLocation,- ElementSize,- CompareFunction,- Buffer);- }-- = if ((Count - NextSwapLocation - 1) >=3D 2) {- QuickSortWorker(- (U= INT8 *)BufferToSort + (NextSwapLocation+1) * ElementSize,- Count - Nex= tSwapLocation - 1,- ElementSize,- CompareFunction,- Buffer);= - }-- return;-} /** Function to perform a Quick Sort alogrithm on a buf= fer of comparable elements. @@ -173,12 +64,13 @@ PerformQuickSort ( Buffer =3D AllocateZeroPool(ElementSize); ASSERT(Buffer !=3D NULL); - = QuickSortWorker(+ QuickSort ( BufferToSort, Count, ElementSiz= e, CompareFunction,- Buffer);+ Buffer+ ); FreePool(Buffer);= return;--=20 2.30.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D Groups.io Links: You receive all messages sent to this group. View/Reply Online (#82204): https://edk2.groups.io/g/devel/message/82204 Mute This Topic: https://groups.io/mt/86406843/4830160 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [ianx.kuo@intel.com] -=3D= -=3D-=3D-=3D-=3D-=3D