nicefy mi_popcount

This commit is contained in:
Daan 2025-06-13 21:45:06 -07:00
parent b10c0f87ee
commit dfa50c37d9
2 changed files with 5 additions and 1 deletions

View file

@ -209,7 +209,7 @@ static inline size_t mi_popcount(size_t x) {
return mi_builtinz(popcount)(x);
#else
#define MI_HAS_FAST_POPCOUNT 0
return (x<=1 ? x : _mi_popcount_generic(x));
return _mi_popcount_generic(x);
#endif
}

View file

@ -383,6 +383,8 @@ static size_t mi_popcount_generic32(uint32_t x) {
}
mi_decl_noinline size_t _mi_popcount_generic(size_t x) {
if (x<=1) return x;
if (~x==0) return MI_SIZE_BITS;
return mi_popcount_generic32(x);
}
@ -407,6 +409,8 @@ static size_t mi_popcount_generic64(uint64_t x) {
}
mi_decl_noinline size_t _mi_popcount_generic(size_t x) {
if (x<=1) return x;
if (~x==0) return MI_SIZE_BITS;
return mi_popcount_generic64(x);
}
#endif