-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
<bitset>: count() should use the same approach as std::popcount #667
Comments
You can directly reference the relevant code here in the issue. That helps a lot as one does not have to search for the code first |
updated |
DevCom-967643 - independently reported. |
This is dependent on a rework of std::popcount :D. Now that we have is_constant_evaluated I'm working on using that instead of the builtins (which are hard to implement correctly in MSVC). Once that happens then maybe bitset can use it. Although there could be problems since the constexpr versions of std::popcount will only work for uint32 and uint64 (we could probably figure out how to make them work for other numbers of bits, but it would be gnarly meta-programming) |
I think builtin would be better here. I imagine that by seeing |
Fortunately, Line 31 in 43e07f3
|
I suppose one could implement vectored instructions, but the folks working on the compiler have better things to do (optimizations that would help more people). __builtin_popcount and friends have behavior that is not implemented by any other intrinsic my msvc_bit_wip branch has my progress and I hope to make that into a pull request this week. |
Similar to `all()` method
bitset<N>::count()
STL/stl/inc/bitset
Lines 341 to 366 in 8e8453c
should use the same compiler magic: as
<bit>
popcount(x)
when it is available:STL/stl/inc/bit
Lines 143 to 150 in 8e8453c
Blocked by the same as #313 .
Disabled here:
STL/stl/inc/yvals_core.h
Lines 1091 to 1096 in 8e8453c
Also tracked by DevCom-967643 and Microsoft-internal VSO-1090007 / AB#1090007.
The text was updated successfully, but these errors were encountered: