Reviewed-by: Michael D Kinney <michael.d.kin...@intel.com> Mike
> -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann > Sent: Wednesday, March 22, 2023 12:03 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D <michael.d.kin...@intel.com>; Aktas, Erdem > <erdemak...@google.com>; James Bottomley <j...@linux.ibm.com>; > Gao, Liming <gaolim...@byosoft.com.cn>; Marvin Häuser <mhaeu...@posteo.de>; > Pawel Polawski <ppola...@redhat.com>; Michael Roth > <michael.r...@amd.com>; Tom Lendacky <thomas.lenda...@amd.com>; Gerd Hoffmann > <kra...@redhat.com>; Yao, Jiewen > <jiewen....@intel.com>; Wang, Jian J <jian.j.w...@intel.com>; Ard Biesheuvel > <ardb+tianoc...@kernel.org>; Justen, Jordan L > <jordan.l.jus...@intel.com>; Wu, Hao A <hao.a...@intel.com>; Liu, Zhiguang > <zhiguang....@intel.com>; Ni, Ray <ray...@intel.com>; > Xu, Min M <min.m...@intel.com>; Oliver Steffen <ostef...@redhat.com> > Subject: [edk2-devel] [PATCH v2 6/6] UefiCpuPkg/MtrrLib: use new IS_POW2() > macro. > > Drop MtrrLibIsPowerOfTwo function, use the new IS_POW2() macro instead. > > The ASSERT() removed (inside MtrrLibIsPowerOfTwo) is superfluous, > another ASSERT() a few lines up in MtrrLibCalculateMtrrs() already > guarantees that Length can not be zero at this point. > > Signed-off-by: Gerd Hoffmann <kra...@redhat.com> > --- > UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 17 +---------------- > 1 file changed, 1 insertion(+), 16 deletions(-) > > diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > index e5c862c83d61..dd0b668d7782 100644 > --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c > @@ -1253,21 +1253,6 @@ MtrrLibLowestType ( > return (MTRR_MEMORY_CACHE_TYPE)Type; > } > > -/** > - Return TRUE when the Operand is exactly power of 2. > - > - @retval TRUE Operand is exactly power of 2. > - @retval FALSE Operand is not power of 2. > -**/ > -BOOLEAN > -MtrrLibIsPowerOfTwo ( > - IN UINT64 Operand > - ) > -{ > - ASSERT (Operand != 0); > - return (BOOLEAN)((Operand & (Operand - 1)) == 0); > -} > - > /** > Calculate the subtractive path from vertex Start to Stop. > > @@ -1638,7 +1623,7 @@ MtrrLibCalculateMtrrs ( > break; > } > > - if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && MtrrLibIsPowerOfTwo > (Length)) { > + if ((Weight[M (Start, Stop)] == MAX_WEIGHT) && IS_POW2 (Length)) { > if (MtrrLibGetNumberOfTypes ( > Ranges, > RangeCount, > -- > 2.39.2 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#101594): https://edk2.groups.io/g/devel/message/101594 Mute This Topic: https://groups.io/mt/97773225/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-