]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/GetPowerOfTwo32.c
Updated to support compiler intrinsics properly. I had to comment out some of the...
[mirror_edk2.git] / MdePkg / Library / BaseLib / GetPowerOfTwo32.c
index dbf4ca65138cef6585e2c550afc359b0308e2098..dcfdc4bdd45197f1a0cb2aeddbffd270c075088f 100644 (file)
 \r
 **/\r
 \r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
 #include "BaseLibInternals.h"\r
 \r
 /**\r
@@ -33,8 +38,9 @@ GetPowerOfTwo32 (
   IN      UINT32                    Operand\r
   )\r
 {\r
-  INTN                              BitPos;\r
-  \r
-  BitPos = HighBitSet32 (Operand);\r
-  return BitPos >= 0 ? 1ul << BitPos : 0;\r
+  if (Operand == 0) {\r
+    return 0;\r
+  }\r
+\r
+  return 1ul << HighBitSet32 (Operand);\r
 }\r