From 98cb6f30f708ef416572bf65bd26ac9f998ae0dc Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 22 Jul 2009 23:34:35 +0200 Subject: janitor: add DIV_ROUND_UP and use it. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- git-compat-util.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'git-compat-util.h') diff --git a/git-compat-util.h b/git-compat-util.h index 6dfc0ddd9..9f941e42b 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -37,6 +37,8 @@ #define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (bitsizeof(x) - (bits)))) #define HAS_MULTI_BITS(i) ((i) & ((i) - 1)) /* checks if an integer has more than 1 bit set */ +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) + /* Approximation of the length of the decimal representation of this type. */ #define decimal_length(x) ((int)(sizeof(x) * 2.56 + 0.5) + 1) -- cgit v1.2.1