summaryrefslogtreecommitdiff
path: root/ewah
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-07-08 10:35:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-07-10 21:24:36 (GMT)
commit42c78a216e751cfa2720c8276c9e9f2b81640e6b (patch)
treeff12c046af74e524d80ec247f8039592337afee6 /ewah
parent8c8e978f5719c6a58fb998742207bf907f963143 (diff)
downloadgit-42c78a216e751cfa2720c8276c9e9f2b81640e6b.zip
git-42c78a216e751cfa2720c8276c9e9f2b81640e6b.tar.gz
git-42c78a216e751cfa2720c8276c9e9f2b81640e6b.tar.bz2
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>
Diffstat (limited to 'ewah')
-rw-r--r--ewah/ewah_bitmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ewah/ewah_bitmap.c b/ewah/ewah_bitmap.c
index 2dc9c82..06c479f 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);