]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - para.h
Replace ROUND_UP by DIV_ROUND_UP and use it everywhere.
[paraslash.git] / para.h
diff --git a/para.h b/para.h
index afb638213e0819a5188f2365a82cc29dcd76fe18..305707da8d5194856fe34c520428dd8410843997 100644 (file)
--- 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]))