9 ms·You can just use __builtin_popcount or equivalent, which maps to a single instruction on most platforms.by averne_ 4y agoYou can just use __builtin_popcount or equivalent, which maps to a single instruction on most platforms.