]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Base.h
MdePkg/Include/Base.h: introduce the ARRAY_SIZE() function-like macro
[mirror_edk2.git] / MdePkg / Include / Base.h
index c66614846488861ec71354df454e8d08d9fabca2..82a773ae744cb7c3767ce681d30c46fefa61921e 100644 (file)
@@ -1211,5 +1211,18 @@ typedef UINTN RETURN_STATUS;
   #define RETURN_ADDRESS(L)     ((VOID *) 0)\r
 #endif\r
 \r
+/**\r
+  Return the number of elements in an array.\r
+\r
+  @param  Array  An object of array type. Array is only used as an argument to\r
+                 the sizeof operator, therefore Array is never evaluated. The\r
+                 caller is responsible for ensuring that Array's type is not\r
+                 incomplete; that is, Array must have known constant size.\r
+\r
+  @return The number of elements in Array. The result has type UINTN.\r
+\r
+**/\r
+#define ARRAY_SIZE(Array) (sizeof (Array) / sizeof ((Array)[0]))\r
+\r
 #endif\r
 \r