]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Fix one bug on EBC for GetPowerOfTwo64.c
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 11 Jul 2006 07:48:43 +0000 (07:48 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 11 Jul 2006 07:48:43 +0000 (07:48 +0000)
2. Fix one bug for GetPowerOfTwo32.c and GetPowerOfTwo64.c, when Operand is 1, 1 should be returned

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@873 6f19259b-4bc3-4df7-8a09-765794883524

MdePkg/Library/BaseLib/GetPowerOfTwo32.c
MdePkg/Library/BaseLib/GetPowerOfTwo64.c

index 6dfe8056b41c776756b108d89fe9acefac43d6ad..dbf4ca65138cef6585e2c550afc359b0308e2098 100644 (file)
@@ -34,6 +34,7 @@ GetPowerOfTwo32 (
   )\r
 {\r
   INTN                              BitPos;\r
-\r
-  return (BitPos = HighBitSet32 (Operand)) > 0 ? 1ul << BitPos : 0;\r
+  \r
+  BitPos = HighBitSet32 (Operand);\r
+  return BitPos >= 0 ? 1ul << BitPos : 0;\r
 }\r
index 9994fb8f12e29acd8cc6cf2bfbebc13deb1d5735..8372a7f1361594ff413134c574edb82d4c83d26e 100644 (file)
@@ -35,5 +35,6 @@ GetPowerOfTwo64 (
 {\r
   INTN                              BitPos;\r
 \r
-  return (BitPos = HighBitSet64 (Operand)) > 0 ? LShiftU64 (1, BitPos) : 0;\r
+  BitPos = HighBitSet64 (Operand);\r
+  return BitPos >= 0 ? LShiftU64 (1, BitPos) : 0;\r
 }\r