summaryrefslogtreecommitdiffstats
path: root/src/include/compiler.h
diff options
context:
space:
mode:
authorMichael Brown2017-03-10 16:40:17 +0100
committerMichael Brown2017-03-10 16:44:11 +0100
commitafdebdc163268bfc31d927cdfbbf92ed1aa93a6f (patch)
tree20ed64d9db9b9f356137daf73a87538edebc3b7a /src/include/compiler.h
parent[iscsi] Don't close when receiving NOP-In (diff)
downloadipxe-afdebdc163268bfc31d927cdfbbf92ed1aa93a6f.tar.gz
ipxe-afdebdc163268bfc31d927cdfbbf92ed1aa93a6f.tar.xz
ipxe-afdebdc163268bfc31d927cdfbbf92ed1aa93a6f.zip
[build] Provide common ARRAY_SIZE() definition
Several files define the ARRAY_SIZE() macro as used in Linux. Provide a common definition for this in include/compiler.h. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/include/compiler.h')
-rw-r--r--src/include/compiler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/compiler.h b/src/include/compiler.h
index 4924c7ef..56a5f63d 100644
--- a/src/include/compiler.h
+++ b/src/include/compiler.h
@@ -656,6 +656,13 @@ char __debug_disable(OBJECT) = ( DBGLVL_MAX & ~DBGLVL_DFLT );
#endif /* ASSEMBLY */
/**
+ * Array size
+ */
+#ifndef ASSEMBLY
+#define ARRAY_SIZE(array) ( sizeof (array) / sizeof ( (array)[0] ) )
+#endif /* ASSEMBLY */
+
+/**
* @defgroup licences Licence declarations
*
* For reasons that are partly historical, various different files