From 42946ec113e8ae6d6bc114dbd90e9721f464abfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 28 Sep 2020 21:14:50 +0200 Subject: Introduce ARRAYSIZE --- Macros.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Macros.h') 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))) -- cgit v1.2.3