File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -209,7 +209,7 @@ static inline size_t mi_popcount(size_t x) {
209209 return mi_builtinz (popcount)(x);
210210 #else
211211 #define MI_HAS_FAST_POPCOUNT 0
212- return (x<= 1 ? x : _mi_popcount_generic (x) );
212+ return _mi_popcount_generic (x);
213213 #endif
214214}
215215
Original file line number Diff line number Diff line change @@ -383,6 +383,8 @@ static size_t mi_popcount_generic32(uint32_t x) {
383383}
384384
385385mi_decl_noinline size_t _mi_popcount_generic (size_t x ) {
386+ if (x <=1 ) return x ;
387+ if (~x == 0 ) return MI_SIZE_BITS ;
386388 return mi_popcount_generic32 (x );
387389}
388390
@@ -407,6 +409,8 @@ static size_t mi_popcount_generic64(uint64_t x) {
407409}
408410
409411mi_decl_noinline size_t _mi_popcount_generic (size_t x ) {
412+ if (x <=1 ) return x ;
413+ if (~x == 0 ) return MI_SIZE_BITS ;
410414 return mi_popcount_generic64 (x );
411415}
412416#endif
You can’t perform that action at this time.
0 commit comments