You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constexpr unsigned long _Stl_bitscan_forward(_Unsigned _Mask) noexcept {
// find the index of the least significant set bit (_BitScanForward isn't constexpr... yet :))
static_assert(is_unsigned_v<_Unsigned>, "Bitscan only works on bits");
unsigned long _Count = 0;
if (_Mask != 0) {
while ((_Mask & 1U) == 0) {
_Mask >>= 1;
++_Count;
}
}
return _Count;
}
For #25 (WG21-P0553<bit> Rotating And Counting Functions), we're getting compiler support for constexpr bitscans (with different intrinsic names). We should use this in gcd().
Note that because <bit> is a C++20 header, we can't include it from <numeric>, nor can we use its non-_Ugly functions to implement C++17 features like gcd(). However, we can use the compiler intrinsics directly, or define _Ugly wrappers for them in centralized headers.
Our
gcd()
implementation contains the following workaround:STL/stl/inc/numeric
Lines 847 to 860 in 58bb49d
For #25 (WG21-P0553
<bit>
Rotating And Counting Functions), we're getting compiler support forconstexpr
bitscans (with different intrinsic names). We should use this ingcd()
.Note that because
<bit>
is a C++20 header, we can't include it from<numeric>
, nor can we use its non-_Ugly
functions to implement C++17 features likegcd()
. However, we can use the compiler intrinsics directly, or define_Ugly
wrappers for them in centralized headers.Also tracked by Microsoft-internal VSO-597250.
The text was updated successfully, but these errors were encountered: