mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-01 09:14:38 +03:00
nicefy mi_popcount
This commit is contained in:
parent
b10c0f87ee
commit
dfa50c37d9
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue