X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=para.h;h=5dec070f00458bd59d62fbb8fed1b3bc60cb31da;hp=eb99ec68e6f2609da70f8d75d3dc038c1c4ea59e;hb=ae15406fdf6ac44dc7a15e62c2d0056abe7192ac;hpb=cb6d1dfb9e4067229a4bbde0abd05784d97ef14b diff --git a/para.h b/para.h index eb99ec68..5dec070f 100644 --- a/para.h +++ b/para.h @@ -206,3 +206,8 @@ static inline int para_random(unsigned max) return ((max + 0.0) * (rand() / (RAND_MAX + 1.0))); } +/** Round up x to a multiple of y */ +#define ROUND_UP(x, y) (((x) + (y - 1) / (y)) * (y)) + +/** Get the size of an array */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))