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 <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2017-07-08 12:35:35 +02:00
committed by Junio C Hamano
parent 8c8e978f57
commit 42c78a216e
9 changed files with 14 additions and 15 deletions

View File

@ -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);