<numeric>
: _Countr_zero
used by std::gcd
has unnecessary zero checks
#2292
Labels
<numeric>
: _Countr_zero
used by std::gcd
has unnecessary zero checks
#2292
Originally reported as DevCom-1560717
_Countr_zero
in this loop has unnecessary checks for zero input in the compiled code:STL/stl/inc/numeric
Lines 567 to 577 in d8f03cf
See the demo with
__assume
workaround: https://godbolt.org/z/Ts7ExjbYbAs the reported noted, compiler codegen could be improved.
But from the library, it can also be fixed by making specialized
_Countr_zero
that does not check for zero input, and calling the specialized version fromstd::gcd
.The text was updated successfully, but these errors were encountered: