From 4ca4d2b9df27f9c58009d623678ac911c544d36c Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 22 Mar 2023 00:02:43 -0700 Subject: 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 Reviewed-by: Ray Ni --- UefiCpuPkg/Library/MtrrLib/MtrrLib.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'UefiCpuPkg') diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c index a66357e..22ec8d2 100644 --- a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c +++ b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c @@ -1274,21 +1274,6 @@ MtrrLibLowestType ( } /** - 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. @param DefaultType Default memory type. @@ -1658,7 +1643,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, -- cgit v1.1