diff options
author | bxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-13 08:05:35 +0000 |
---|---|---|
committer | bxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-13 08:05:35 +0000 |
commit | 3cc092acf2aa8b76815a1adca2cc3775dd9f7753 (patch) | |
tree | dee4ab5b49b7a89102a9d948e84d51004ceab1ed /MdePkg/Library/BaseLib/GetPowerOfTwo32.c | |
parent | 0898f771628c4c9004d5e2716612c57b13123a93 (diff) | |
download | edk2-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/GetPowerOfTwo32.c')
-rw-r--r-- | MdePkg/Library/BaseLib/GetPowerOfTwo32.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c index dbf4ca6513..a639fd4a6d 100644 --- a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c +++ b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c @@ -33,8 +33,9 @@ GetPowerOfTwo32 ( IN UINT32 Operand
)
{
- INTN BitPos;
-
- BitPos = HighBitSet32 (Operand);
- return BitPos >= 0 ? 1ul << BitPos : 0;
+ if (Operand == 0) {
+ return 0;
+ }
+
+ return 1ul << HighBitSet32 (Operand);
}
|