mirror of
https://github.com/git/git.git
synced 2024-11-24 18:33:43 +08:00
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>
This commit is contained in:
parent
282616c72d
commit
414382fb00
@ -20,8 +20,8 @@
|
||||
#include "git-compat-util.h"
|
||||
#include "ewok.h"
|
||||
|
||||
#define MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
|
||||
#define BLOCK(x) (x / BITS_IN_WORD)
|
||||
#define EWAH_MASK(x) ((eword_t)1 << (x % BITS_IN_WORD))
|
||||
#define EWAH_BLOCK(x) (x / BITS_IN_WORD)
|
||||
|
||||
struct bitmap *bitmap_new(void)
|
||||
{
|
||||
@ -33,7 +33,7 @@ struct bitmap *bitmap_new(void)
|
||||
|
||||
void bitmap_set(struct bitmap *self, size_t pos)
|
||||
{
|
||||
size_t block = BLOCK(pos);
|
||||
size_t block = EWAH_BLOCK(pos);
|
||||
|
||||
if (block >= self->word_alloc) {
|
||||
size_t old_size = self->word_alloc;
|
||||
@ -45,22 +45,22 @@ void bitmap_set(struct bitmap *self, size_t pos)
|
||||
(self->word_alloc - old_size) * sizeof(eword_t));
|
||||
}
|
||||
|
||||
self->words[block] |= MASK(pos);
|
||||
self->words[block] |= EWAH_MASK(pos);
|
||||
}
|
||||
|
||||
void bitmap_clear(struct bitmap *self, size_t pos)
|
||||
{
|
||||
size_t block = BLOCK(pos);
|
||||
size_t block = EWAH_BLOCK(pos);
|
||||
|
||||
if (block < self->word_alloc)
|
||||
self->words[block] &= ~MASK(pos);
|
||||
self->words[block] &= ~EWAH_MASK(pos);
|
||||
}
|
||||
|
||||
int bitmap_get(struct bitmap *self, size_t pos)
|
||||
{
|
||||
size_t block = BLOCK(pos);
|
||||
size_t block = EWAH_BLOCK(pos);
|
||||
return block < self->word_alloc &&
|
||||
(self->words[block] & MASK(pos)) != 0;
|
||||
(self->words[block] & EWAH_MASK(pos)) != 0;
|
||||
}
|
||||
|
||||
struct ewah_bitmap *bitmap_to_ewah(struct bitmap *bitmap)
|
||||
|
Loading…
Reference in New Issue
Block a user