summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2023-03-22 00:02:43 -0700
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-04-01 23:11:44 +0000
commit4ca4d2b9df27f9c58009d623678ac911c544d36c (patch)
tree8b2ad68c9f4dc612c59a09a0b8606b4896bf2b55 /UefiCpuPkg
parent12d3d60f51550a7166f8f3e758866b53b9a88e73 (diff)
downloadedk2-4ca4d2b9df27f9c58009d623678ac911c544d36c.tar.gz
edk2-4ca4d2b9df27f9c58009d623678ac911c544d36c.tar.bz2
edk2-4ca4d2b9df27f9c58009d623678ac911c544d36c.zip
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 <kraxel@redhat.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'UefiCpuPkg')
-rw-r--r--UefiCpuPkg/Library/MtrrLib/MtrrLib.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/UefiCpuPkg/Library/MtrrLib/MtrrLib.c b/UefiCpuPkg/Library/MtrrLib/MtrrLib.c
index a66357e305..22ec8d2a48 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,