From 327364d277609600aa19aabd6dc55f2fc7dfb8cf Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Mon, 14 Nov 2016 17:37:35 +0200 Subject: [PATCH] utils: rename popcount to avoid conflict in NetBSD Resolves https://github.com/xkbcommon/libxkbcommon/issues/41 Signed-off-by: Ran Benita --- src/state.c | 2 +- src/utils.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/state.c b/src/state.c index 039115a..00495f7 100644 --- a/src/state.c +++ b/src/state.c @@ -1359,7 +1359,7 @@ key_get_consumed(struct xkb_state *state, const struct xkb_key *key, if (XkbLevelsSameSyms(level, no_mods_level)) continue; - if (entry == matching_entry || popcount(entry->mods.mask) == 1) + if (entry == matching_entry || my_popcount(entry->mods.mask) == 1) consumed |= entry->mods.mask & ~entry->preserve.mask; } break; diff --git a/src/utils.h b/src/utils.h index 11ef735..d63d23a 100644 --- a/src/utils.h +++ b/src/utils.h @@ -178,8 +178,9 @@ msb_pos(uint32_t mask) return pos; } +// Avoid conflict with other popcount()s. static inline int -popcount(uint32_t x) +my_popcount(uint32_t x) { int count; #if defined(HAVE___BUILTIN_POPCOUNT)