diff options
author | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-11 07:48:43 +0000 |
---|---|---|
committer | vanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-11 07:48:43 +0000 |
commit | 4748b24d77d65a13dd2bcb0f9fa9ed83f24f9bf4 (patch) | |
tree | f34684b597c823cb9d1a197ccb715037e6ab366d /MdePkg/Library/BaseLib | |
parent | 67513de53722cf54a414dd80cc68e7d48f73be78 (diff) | |
download | edk2-platforms-4748b24d77d65a13dd2bcb0f9fa9ed83f24f9bf4.tar.xz |
1. Fix one bug on EBC for GetPowerOfTwo64.c
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
Diffstat (limited to 'MdePkg/Library/BaseLib')
-rw-r--r-- | MdePkg/Library/BaseLib/GetPowerOfTwo32.c | 5 | ||||
-rw-r--r-- | MdePkg/Library/BaseLib/GetPowerOfTwo64.c | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c index 6dfe8056b4..dbf4ca6513 100644 --- a/MdePkg/Library/BaseLib/GetPowerOfTwo32.c +++ b/MdePkg/Library/BaseLib/GetPowerOfTwo32.c @@ -34,6 +34,7 @@ GetPowerOfTwo32 ( )
{
INTN BitPos;
-
- return (BitPos = HighBitSet32 (Operand)) > 0 ? 1ul << BitPos : 0;
+
+ BitPos = HighBitSet32 (Operand);
+ return BitPos >= 0 ? 1ul << BitPos : 0;
}
diff --git a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c index 9994fb8f12..8372a7f136 100644 --- a/MdePkg/Library/BaseLib/GetPowerOfTwo64.c +++ b/MdePkg/Library/BaseLib/GetPowerOfTwo64.c @@ -35,5 +35,6 @@ GetPowerOfTwo64 ( {
INTN BitPos;
- return (BitPos = HighBitSet64 (Operand)) > 0 ? LShiftU64 (1, BitPos) : 0;
+ BitPos = HighBitSet64 (Operand);
+ return BitPos >= 0 ? LShiftU64 (1, BitPos) : 0;
}
|