summaryrefslogtreecommitdiff
path: root/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-13 08:05:35 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-13 08:05:35 +0000
commit3cc092acf2aa8b76815a1adca2cc3775dd9f7753 (patch)
treedee4ab5b49b7a89102a9d948e84d51004ceab1ed /MdePkg/Library/BaseLib/GetPowerOfTwo64.c
parent0898f771628c4c9004d5e2716612c57b13123a93 (diff)
downloadedk2-platforms-3cc092acf2aa8b76815a1adca2cc3775dd9f7753.tar.xz
Revised GetPowerOfTwo32() and GetPowerOfTwo64() to be more efficient.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@963 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdePkg/Library/BaseLib/GetPowerOfTwo64.c')
-rw-r--r--MdePkg/Library/BaseLib/GetPowerOfTwo64.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
index 8372a7f136..52d148c924 100644
--- a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
+++ b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c
@@ -33,8 +33,9 @@ GetPowerOfTwo64 (
IN UINT64 Operand
)
{
- INTN BitPos;
+ if (Operand == 0) {
+ return 0;
+ }
- BitPos = HighBitSet64 (Operand);
- return BitPos >= 0 ? LShiftU64 (1, BitPos) : 0;
+ return LShiftU64 (1, HighBitSet64 (Operand));
}