summaryrefslogtreecommitdiff
path: root/ewah/bitmap.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-06-03 06:39:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-03 07:04:01 (GMT)
commit34b935c01f28d34f6764f0e1140ad47e7abdde1b (patch)
treef033bf6a1c6c1896e712c465ddaff50ad78fa3e2 /ewah/bitmap.c
parent414382fb00c72babe2b22ef0fa757ea7c960f5ce (diff)
downloadgit-34b935c01f28d34f6764f0e1140ad47e7abdde1b.zip
git-34b935c01f28d34f6764f0e1140ad47e7abdde1b.tar.gz
git-34b935c01f28d34f6764f0e1140ad47e7abdde1b.tar.bz2
ewah: use less generic macro name
The ewah/ewok.h header pollutes the global namespace with "BITS_IN_WORD", without any specific notion that we are talking about the bits in an eword_t. We can give this the more specific name "BITS_IN_EWORD". Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ewah/bitmap.c')
-rw-r--r--ewah/bitmap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ewah/bitmap.c b/ewah/bitmap.c
index 2af94f6..47ad674 100644
--- a/ewah/bitmap.c
+++ b/ewah/bitmap.c
@@ -20,8 +20,8 @@
#include "git-compat-util.h"
#include "ewok.h"
-#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
-#define EWAH_BLOCK(x) (x / BITS_IN_WORD)
+#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_EWORD))
+#define EWAH_BLOCK(x) (x / BITS_IN_EWORD)
struct bitmap *bitmap_new(void)
{
@@ -127,7 +127,7 @@ void bitmap_and_not(struct bitmap *self, struct bitmap *other)
void bitmap_or_ewah(struct bitmap *self, struct ewah_bitmap *other)
{
size_t original_size = self->word_alloc;
- size_t other_final = (other->bit_size / BITS_IN_WORD) + 1;
+ size_t other_final = (other->bit_size / BITS_IN_EWORD) + 1;
size_t i = 0;
struct ewah_iterator it;
eword_t word;
@@ -155,17 +155,17 @@ void bitmap_each_bit(struct bitmap *self, ewah_callback callback, void *data)
uint32_t offset;
if (word == (eword_t)~0) {
- for (offset = 0; offset < BITS_IN_WORD; ++offset)
+ for (offset = 0; offset < BITS_IN_EWORD; ++offset)
callback(pos++, data);
} else {
- for (offset = 0; offset < BITS_IN_WORD; ++offset) {
+ for (offset = 0; offset < BITS_IN_EWORD; ++offset) {
if ((word >> offset) == 0)
break;
offset += ewah_bit_ctz64(word >> offset);
callback(pos + offset, data);
}
- pos += BITS_IN_WORD;
+ pos += BITS_IN_EWORD;
}
}
}