From: Jeff King <peff@peff.net>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Junio C Hamano <gitster@pobox.com>, Git List <git@vger.kernel.org>
Subject: [PATCH 1/2] ewah/bitmap: silence warning about MASK macro redefinition
Date: Wed, 3 Jun 2015 02:39:17 -0400 [thread overview]
Message-ID: <20150603063917.GA29008@peff.net> (raw)
In-Reply-To: <20150603063812.GA21319@peff.net>
From: Eric Sunshine <sunshine@sunshineco.com>
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: Jeff King <peff@peff.net>
---
ewah/bitmap.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ewah/bitmap.c b/ewah/bitmap.c
index 710e58c..2af94f6 100644
--- a/ewah/bitmap.c
+++ b/ewah/bitmap.c
@@ -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)
--
2.4.2.745.g0aa058d
next prev parent reply other threads:[~2015-06-03 6:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 21:47 [PATCH] ewah/bitmap: silence warning about MASK macro redefinition Eric Sunshine
2015-06-02 22:15 ` Junio C Hamano
2015-06-03 4:51 ` Jeff King
2015-06-03 6:28 ` Eric Sunshine
2015-06-03 6:38 ` Jeff King
2015-06-03 6:39 ` Jeff King [this message]
2015-06-03 6:46 ` [PATCH 1/2] " Eric Sunshine
2015-06-03 6:39 ` [PATCH 2/2] ewah: use less generic macro name Jeff King
2015-06-03 6:51 ` Eric Sunshine
2015-06-03 6:50 ` [PATCH] ewah/bitmap: silence warning about MASK macro redefinition Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150603063917.GA29008@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.