[edk2-devel] [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

IanX Kuo ianx.kuo at intel.com
Mon Oct 18 03:57:38 UTC 2021


Thanks for the comment.
It will be taken care by V5 patch.

Thanks,
Ian Kuo
-----Original Message-----
From: Ni, Ray <ray.ni at intel.com> 
Sent: Monday, October 18, 2021 11:42 AM
To: Kuo, IanX <ianx.kuo at intel.com>; devel at edk2.groups.io
Cc: Chan, Amy <amy.chan at intel.com>; Dong, Eric <eric.dong at intel.com>; Kumar, Rahul1 <rahul1.kumar at intel.com>
Subject: RE: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

Ian,
Thanks for cleaning up the code to remove MdeModulePkg  dependency.

Minor comments below:

   UINTN                     NextIndex;
+  VOID                      *QuickSortBuffer;

1.  Can you use local variable? "CPU_CACHE_INFO    SortBuffer".


-    PerformQuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), (SORT_COMPARE) CpuCacheInfoCompare);
+    QuickSortBuffer = AllocateZeroPool (sizeof (*LocalCacheInfo));
+    if (QuickSortBuffer == NULL) {
+      return EFI_OUT_OF_RESOURCES;
+    }

2. With #1 change, you can avoid "calling AllocateZeroPool() and checking pointer".

+    QuickSort (LocalCacheInfo, LocalCacheInfoCount, sizeof (*LocalCacheInfo), CpuCacheInfoCompare, QuickSortBuffer);

3. Just pass "&SortBuffer" as the last parameter.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#82202): https://edk2.groups.io/g/devel/message/82202
Mute This Topic: https://groups.io/mt/86381254/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list