From 42c78a216e751cfa2720c8276c9e9f2b81640e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 8 Jul 2017 12:35:35 +0200 Subject: use DIV_ROUND_UP Convert code that divides and rounds up to use DIV_ROUND_UP to make the intent clearer and reduce the number of magic constants. Signed-off-by: Rene Scharfe Reviewed-by: Jeff King Signed-off-by: Junio C Hamano --- ewah/ewah_bitmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ewah') diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c index 2dc9c82ecf..06c479f70a 100644 --- a/ewah/ewah_bitmap.c +++ b/ewah/ewah_bitmap.c @@ -210,8 +210,8 @@ size_t ewah_add(struct ewah_bitmap *self, eword_t word) void ewah_set(struct ewah_bitmap *self, size_t i) { const size_t dist = - (i + BITS_IN_EWORD) / BITS_IN_EWORD - - (self->bit_size + BITS_IN_EWORD - 1) / BITS_IN_EWORD; + DIV_ROUND_UP(i + 1, BITS_IN_EWORD) - + DIV_ROUND_UP(self->bit_size, BITS_IN_EWORD); assert(i >= self->bit_size); -- cgit v1.2.3