Introduce ARRAYSIZE

This commit is contained in:
Christian Göttsche
2020-09-28 21:14:50 +02:00
parent b82a13c6ba
commit 42946ec113
4 changed files with 7 additions and 3 deletions

View File

@ -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)))