Closed joaquintides closed 1 year ago
Yes, because the MSVC bitscan intrinsics aren't constexpr.
Can't std::is_constant_evaluated()
be leveraged to remedy this?
std::is_constant_evaluated
is C++20, so the gains will be marginal.
This is better than nothing... At least the BOOST_CONSTEXPR
qualifier should be conditionally removed in VS. Another possibility is to provide constexpr_bit_width
etc. versions for those who need them.
There's no need to remove the qualifier.
It might be possible to use the is_constant_evaluated intrinsic: https://github.com/microsoft/STL/blob/5e3574b97985db31112a1c60e4eb52e821d25a83/stl/inc/xtr1common#L170
This should be available in all language modes, but I'll need to check which MSVC versions have it.
Looks like the intrinsic is available from Visual Studio 2019, versión 16.5 onwards.
The following
yields