4 ms·
C++20 added std::popcount() in the new header <bit> If you haven't told it that the target ISA has the POPCNT instruction, std::popcount() on MSVC will use run
by ynik 5y ago
C++20 added std::popcount() in the new header <bit>
If you haven't told it that the target ISA has the POPCNT instruction, std::popcount() on MSVC will use runtime feature detection: https://godbolt.org/z/qab4Mjv1v https://godbolt.org/z/qab4Mjv1v
- ncmncm 5y agoCuriously, for std::bitset<32>(i).count(), MSVC (VS 16.9) still generates a loop, regardless.