commit c5adab025852c68bc637c4fbfa34c44cde7397bb Author: Taylor Yu catalyst@torproject.org Date: Wed Apr 5 14:52:48 2017 -0400
Make CEIL_DIV() slightly more overflow-safe --- src/common/util.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/common/util.h b/src/common/util.h index cfe47f0..18eb57f 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -163,9 +163,9 @@ int64_t clamp_double_to_int64(double number); void simplify_fraction64(uint64_t *numer, uint64_t *denom);
/* Compute the CEIL of <b>a</b> divided by <b>b</b>, for nonnegative <b>a</b> - * and positive <b>b</b>. Works on integer types only. Not defined if a+b can - * overflow. */ -#define CEIL_DIV(a,b) (((a)+(b)-1)/(b)) + * and positive <b>b</b>. Works on integer types only. Not defined if a+(b-1) + * can overflow. */ +#define CEIL_DIV(a,b) (((a)+((b)-1))/(b))
/* Return <b>v</b> if it's between <b>min</b> and <b>max</b>. Otherwise * return <b>min</b> if <b>v</b> is smaller than <b>min</b>, or <b>max</b> if
tor-commits@lists.torproject.org