X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=para.h;h=305707da8d5194856fe34c520428dd8410843997;hb=00837775857a5c40c8c8da8ac509c3e751312ea3;hp=afb638213e0819a5188f2365a82cc29dcd76fe18;hpb=8d5053bf55b02b106cef1cfcce9fc30d9a248b89;p=paraslash.git diff --git a/para.h b/para.h index afb63821..305707da 100644 --- a/para.h +++ b/para.h @@ -165,9 +165,9 @@ _static_inline_ long int para_random(unsigned max) return ((max + 0.0) * (random() / (RAND_MAX + 1.0))); } -/** Round up x to a multiple of y */ -#define ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) - +#define DIV_ROUND_UP(x, y) ({ \ + typeof(y) _divisor = y; \ + ((x) + _divisor - 1) / _divisor; }) /** Get the size of an array */ #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))