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:

committed by
Junio C Hamano

parent
8c8e978f57
commit
42c78a216e
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user