Skip to content

Commit 414382f

Browse files
sunshinecogitster
authored andcommitted
ewah/bitmap: silence warning about MASK macro redefinition
On PowerPC Mac OS X (10.5.8 "Leopard" with Xcode 3.1), system header /usr/include/ppc/param.h[1] pollutes the preprocessor namespace with a macro generically named MASK. This conflicts with the same-named macro in ewah/bitmap.c. We can avoid this conflict by using a more specific name. [1]: Included indirectly via: git-compat-util.h -> sys/sysctl.h -> sys/ucred.h -> sys/param.h -> machine/param.h -> ppc/param.h Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 282616c commit 414382f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ewah/bitmap.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
#include "git-compat-util.h"
2121
#include "ewok.h"
2222

23-
#define MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
24-
#define BLOCK(x) (x / BITS_IN_WORD)
23+
#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
24+
#define EWAH_BLOCK(x) (x / BITS_IN_WORD)
2525

2626
struct bitmap *bitmap_new(void)
2727
{
@@ -33,7 +33,7 @@ struct bitmap *bitmap_new(void)
3333

3434
void bitmap_set(struct bitmap *self, size_t pos)
3535
{
36-
size_t block = BLOCK(pos);
36+
size_t block = EWAH_BLOCK(pos);
3737

3838
if (block >= self->word_alloc) {
3939
size_t old_size = self->word_alloc;
@@ -45,22 +45,22 @@ void bitmap_set(struct bitmap *self, size_t pos)
4545
(self->word_alloc - old_size) * sizeof(eword_t));
4646
}
4747

48-
self->words[block] |= MASK(pos);
48+
self->words[block] |= EWAH_MASK(pos);
4949
}
5050

5151
void bitmap_clear(struct bitmap *self, size_t pos)
5252
{
53-
size_t block = BLOCK(pos);
53+
size_t block = EWAH_BLOCK(pos);
5454

5555
if (block < self->word_alloc)
56-
self->words[block] &= ~MASK(pos);
56+
self->words[block] &= ~EWAH_MASK(pos);
5757
}
5858

5959
int bitmap_get(struct bitmap *self, size_t pos)
6060
{
61-
size_t block = BLOCK(pos);
61+
size_t block = EWAH_BLOCK(pos);
6262
return block < self->word_alloc &&
63-
(self->words[block] & MASK(pos)) != 0;
63+
(self->words[block] & EWAH_MASK(pos)) != 0;
6464
}
6565

6666
struct ewah_bitmap *bitmap_to_ewah(struct bitmap *bitmap)

0 commit comments

Comments
 (0)