]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/BitField.c
Changing unsigned int into UINTN according to code review comments.
[mirror_edk2.git] / MdePkg / Library / BaseLib / BitField.c
index 8c713b29bd2edf8b9d858ac2dc4d5d071a152bc7..533a07564641cb01f1b0ccb2e25e01e2f37a0121 100644 (file)
   @return The bit field read.\r
 \r
 **/\r
-unsigned int\r
+UINTN\r
 EFIAPI\r
 BitFieldReadUint (\r
-  IN      unsigned int              Operand,\r
+  IN      UINTN                     Operand,\r
   IN      UINTN                     StartBit,\r
   IN      UINTN                     EndBit\r
   )\r
 {\r
   //\r
-  // ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
+  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
   // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.\r
   //\r
-  return (Operand & ~((unsigned int)-2 << EndBit)) >> StartBit;\r
+  return (Operand & ~((UINTN)-2 << EndBit)) >> StartBit;\r
 }\r
 \r
 /**\r
@@ -57,20 +57,20 @@ BitFieldReadUint (
   @return The new value.\r
 \r
 **/\r
-unsigned int\r
+UINTN\r
 EFIAPI\r
 BitFieldOrUint (\r
-  IN      unsigned int              Operand,\r
+  IN      UINTN                     Operand,\r
   IN      UINTN                     StartBit,\r
   IN      UINTN                     EndBit,\r
-  IN      unsigned int              OrData\r
+  IN      UINTN                     OrData\r
   )\r
 {\r
   //\r
-  // ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
+  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
   // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.\r
   //\r
-  return Operand | ((OrData << StartBit) & ~((unsigned int) -2 << EndBit));\r
+  return Operand | ((OrData << StartBit) & ~((UINTN) -2 << EndBit));\r
 }\r
 \r
 /**\r
@@ -89,20 +89,20 @@ BitFieldOrUint (
   @return The new value.\r
 \r
 **/\r
-unsigned int\r
+UINTN\r
 EFIAPI\r
 BitFieldAndUint (\r
-  IN      unsigned int              Operand,\r
+  IN      UINTN                     Operand,\r
   IN      UINTN                     StartBit,\r
   IN      UINTN                     EndBit,\r
-  IN      unsigned int              AndData\r
+  IN      UINTN                     AndData\r
   )\r
 {\r
   //\r
-  // ~((unsigned int)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
+  // ~((UINTN)-2 << EndBit) is a mask in which bit[0] thru bit[EndBit]\r
   // are 1's while bit[EndBit + 1] thru the most significant bit are 0's.\r
   //\r
-  return Operand & ~((~AndData << StartBit) & ~((unsigned int) -2 << EndBit));\r
+  return Operand & ~((~AndData << StartBit) & ~((UINTN)-2 << EndBit));\r
 }\r
 \r
 /**\r