aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/math.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
committerJosh Rahm <joshuarahm@gmail.com>2024-11-19 22:57:13 +0000
commit9be89f131f87608f224f0ee06d199fcd09d32176 (patch)
tree11022dcfa9e08cb4ac5581b16734196128688d48 /src/nvim/math.c
parentff7ed8f586589d620a806c3758fac4a47a8e7e15 (diff)
parent88085c2e80a7e3ac29aabb6b5420377eed99b8b6 (diff)
downloadrneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.gz
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.tar.bz2
rneovim-9be89f131f87608f224f0ee06d199fcd09d32176.zip
Merge remote-tracking branch 'upstream/master' into mix_20240309
Diffstat (limited to 'src/nvim/math.c')
-rw-r--r--src/nvim/math.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nvim/math.c b/src/nvim/math.c
index 1ccf4d7806..4ca212413b 100644
--- a/src/nvim/math.c
+++ b/src/nvim/math.c
@@ -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++;