[Bug libstdc++/98226] Slow std::countr_one
zaikin.icc at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Dec 11 12:21:49 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98226
--- Comment #12 from Oleg Zaikin <zaikin.icc at gmail dot com> ---
(In reply to Alexander Monakov from comment #10)
> But why you are trying to use a more complex branchy expression in C++17
> mode when you already have a more efficient expression as a "fallback"?
>
> Note that a cheaper way is available:
>
> return (x+1) & ~x;
>
> (though gcc can optimize '(y ^ x) & y' you have to the same machine code)
Thank you! We will try it.
More information about the Gcc-bugs
mailing list