From: Martin Mares Date: Mon, 24 Feb 2020 14:14:55 +0000 (+0100) Subject: Library: ARRAY_SIZE X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=38f51167915998a4c795bb385b8f3505a15c42e8;p=home-hw.git Library: ARRAY_SIZE --- diff --git a/lib/util.h b/lib/util.h index f7fe61d..6b9f4ba 100644 --- a/lib/util.h +++ b/lib/util.h @@ -24,6 +24,7 @@ typedef int32_t s32; #define MIN(x,y) ((x) < (y) ? (x) : (y)) #define MAX(x,y) ((x) > (y) ? (x) : (y)) #define CLAMP(x,min,max) ({ typeof(x) _t=x; (_t < min) ? min : (_t > max) ? max : _t; }) +#define ARRAY_SIZE(ary) (sizeof(ary)/sizeof((ary)[0])) #define UNUSED __attribute__((unused))