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]))