From: "Ni, Ray" <ray.ni@intel.com>
To: "Kuo, IanX" <ianx.kuo@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Chan, Amy" <amy.chan@intel.com>,
"Dong, Eric" <eric.dong@intel.com>,
"Kumar, Rahul1" <rahul1.kumar@intel.com>
Subject: Re: [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib
Date: Mon, 18 Oct 2021 03:42:16 +0000 [thread overview]
Message-ID: <BN0PR11MB569697DDBC19B0B05E411E878CBC9@BN0PR11MB5696.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20211016223406.935-4-ianx.kuo@intel.com>
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.
next prev parent reply other threads:[~2021-10-18 3:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-16 22:34 [PATCH v3 0/3] Add function QuickSort into MdePkg/BaseLib IanX Kuo
2021-10-16 22:34 ` [PATCH v3 1/3] MdeModulePkg/SortLib: Add QuickSort function on BaseLib IanX Kuo
2021-10-18 1:58 ` IanX Kuo
2021-10-18 2:50 ` 回复: [edk2-devel] " gaoliming
2021-10-16 22:34 ` [PATCH v3 2/3] CryptoPkg/CryptLib: " IanX Kuo
2021-10-17 2:23 ` Yao, Jiewen
2021-10-16 22:34 ` [PATCH v3 3/3] UefiCpuPkg/CpuCacheInfoLib: " IanX Kuo
2021-10-18 1:57 ` IanX Kuo
2021-10-18 3:42 ` Ni, Ray [this message]
2021-10-18 3:57 ` IanX Kuo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BN0PR11MB569697DDBC19B0B05E411E878CBC9@BN0PR11MB5696.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox