Files
gddr6/include/nva/util.h
Ole Algoritme 698a8f7487 first commit
2022-09-05 21:52:22 +02:00

20 lines
326 B
C

#ifndef UTIL_H
#define UTIL_H
#define ARRAY_SIZE(a) (sizeof (a) / sizeof *(a))
#define ADDARRAY(a, e) \
do { \
if ((a ## num) >= (a ## max)) { \
if (!(a ## max)) \
(a ## max) = 16; \
else \
(a ## max) *= 2; \
(a) = realloc((a), (a ## max)*sizeof(*(a))); \
} \
(a)[(a ## num)++] = (e); \
} while(0)
#endif