X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=para.h;h=305707da8d5194856fe34c520428dd8410843997;hb=23b1141809ea872a144d8dbe6d123e93e74094de;hp=afb638213e0819a5188f2365a82cc29dcd76fe18;hpb=5bf80b0268b0afb3984aea74d41eddef34d50d03;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]))