summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-09-28 21:14:50 +0200
committerChristian Göttsche <cgzones@googlemail.com>2020-10-03 19:05:40 +0200
commit42946ec113e8ae6d6bc114dbd90e9721f464abfb (patch)
tree3b30fc9a612905cd4e2b868804ac81cd2c90b403 /Macros.h
parentb82a13c6ba48eb8711071342bec80798aca5de1c (diff)
Introduce ARRAYSIZE
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/Macros.h b/Macros.h
index ef4e8908..de674eda 100644
--- a/Macros.h
+++ b/Macros.h
@@ -13,6 +13,10 @@
#define CLAMP(x, low, high) (((x) > (high)) ? (high) : MAXIMUM(x, low))
#endif
+#ifndef ARRAYSIZE
+#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
+#endif
+
#ifdef __GNUC__ // defined by GCC and Clang
#define ATTR_FORMAT(type, index, check) __attribute__((format (type, index, check)))

© 2014-2024 Faster IT GmbH | imprint | privacy policy