From 2229029afc183e4b84c255893d0a2974d8086863 Mon Sep 17 00:00:00 2001 From: mdkinney Date: Wed, 1 Jul 2009 18:05:03 +0000 Subject: [PATCH] Update BASE_ARG() macro to pass static analysis tools. This change should not cause any changes in behavior git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8707 6f19259b-4bc3-4df7-8a09-765794883524 --- MdePkg/Include/Base.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index f429acd658..3f71098861 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -414,6 +414,15 @@ typedef CHAR8 *VA_LIST; /// typedef UINTN *BASE_LIST; +/** + Returns the size of a data type in sizeof(UINTN) units rounded up to the nearest UINTN boundary. + + @param TYPE The date type to determine the size of. + + @return The size of TYPE in sizeof (UINTN) units rounded up to the nearest UINTN boundary. +**/ +#define _BASE_INT_SIZE_OF(TYPE) ((sizeof (TYPE) + sizeof (UINTN) - 1) / sizeof (UINTN)) + /** Returns an argument of a specified type from a variable argument list and updates the pointer to the variable argument list to point to the next argument. @@ -430,7 +439,7 @@ typedef UINTN *BASE_LIST; @return An argument of the type specified by TYPE. **/ -#define BASE_ARG(Marker, TYPE) (*(TYPE *)((UINT8 *)(Marker = (BASE_LIST)((UINT8 *)Marker + _INT_SIZE_OF (TYPE))) - _INT_SIZE_OF (TYPE))) +#define BASE_ARG(Marker, TYPE) (*(TYPE *) ((Marker += _BASE_INT_SIZE_OF (TYPE)) - _BASE_INT_SIZE_OF (TYPE))) /** Macro that returns the byte offset of a field in a data structure. -- 2.39.2