Merge branch 'hv/t5526-andand-chain-fix' into next
[gitweb.git] / ewah / ewah_bitmap.c
index 2dc9c82ecf513ed721f290926f042b9f592221c2..06c479f70a8eef4d2c9537be2723d7ccc10ae845 100644 (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);