mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
Merge pull request #29038 from neovim/backport-28983-to-release-0.10
fix: "popcount" name conflict on NetBSD
This commit is contained in:
@ -2384,8 +2384,8 @@ void nvim__redraw(Dict(redraw) *opts, Error *err)
|
||||
}
|
||||
}
|
||||
|
||||
int count = (win != NULL) + (buf != NULL);
|
||||
VALIDATE(popcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
|
||||
unsigned count = (win != NULL) + (buf != NULL);
|
||||
VALIDATE(xpopcount(opts->is_set__redraw_) > count, "%s", "at least one action required", {
|
||||
return;
|
||||
});
|
||||
|
||||
|
@ -78,13 +78,15 @@ int xctz(uint64_t x)
|
||||
}
|
||||
|
||||
/// Count number of set bits in bit field.
|
||||
int popcount(uint64_t x)
|
||||
unsigned xpopcount(uint64_t x)
|
||||
{
|
||||
// Use compiler builtin if possible.
|
||||
#if defined(__clang__) || defined(__GNUC__)
|
||||
return __builtin_popcountll(x);
|
||||
#if defined(__NetBSD__)
|
||||
return popcount64(x);
|
||||
#elif defined(__clang__) || defined(__GNUC__)
|
||||
return (unsigned)__builtin_popcountll(x);
|
||||
#else
|
||||
int count = 0;
|
||||
unsigned count = 0;
|
||||
for (; x != 0; x >>= 1) {
|
||||
if (x & 1) {
|
||||
count++;
|
||||
|
Reference in New Issue
Block a user