4 ms·
count_ones() is a challenge on its own. https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive https://graphics.stanford.edu/~seander/bithacks.
by someweirdperson 4y ago
count_ones() is a challenge on its own.
https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetNaive https://graphics.stanford.edu/~seander/bithacks.html#CountBi...
- averne_ 4y agoYou can just use __builtin_popcount or equivalent, which maps to a single instruction on most platforms.