]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Base.h
Update BASE_ARG() macro to pass static analysis tools. This change should not cause...
[mirror_edk2.git] / MdePkg / Include / Base.h
index f429acd65834ad8edeb39d730e494ce7011ee6db..3f71098861f2b3a6dafe51ce930e89a8fd50a898 100644 (file)
@@ -414,6 +414,15 @@ typedef CHAR8 *VA_LIST;
 ///\r
 typedef UINTN  *BASE_LIST;\r
 \r
+/**\r
+  Returns the size of a data type in sizeof(UINTN) units rounded up to the nearest UINTN boundary.\r
+\r
+  @param  TYPE  The date type to determine the size of.\r
+\r
+  @return The size of TYPE in sizeof (UINTN) units rounded up to the nearest UINTN boundary.\r
+**/\r
+#define _BASE_INT_SIZE_OF(TYPE) ((sizeof (TYPE) + sizeof (UINTN) - 1) / sizeof (UINTN))\r
+\r
 /**\r
   Returns an argument of a specified type from a variable argument list and updates \r
   the pointer to the variable argument list to point to the next argument. \r
@@ -430,7 +439,7 @@ typedef UINTN  *BASE_LIST;
   @return  An argument of the type specified by TYPE.\r
 \r
 **/\r
-#define BASE_ARG(Marker, TYPE) (*(TYPE *)((UINT8 *)(Marker = (BASE_LIST)((UINT8 *)Marker + _INT_SIZE_OF (TYPE))) - _INT_SIZE_OF (TYPE)))\r
+#define BASE_ARG(Marker, TYPE)   (*(TYPE *) ((Marker += _BASE_INT_SIZE_OF (TYPE)) - _BASE_INT_SIZE_OF (TYPE)))\r
 \r
 /**\r
   Macro that returns the byte offset of a field in a data structure. \r