[Bug libstdc++/97759] Could std::has_single_bit be faster?

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 4 22:56:45 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97759

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org
   Last reconfirmed|                            |2024-03-04
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>popcount (x) == 1 || x == 0

That could be optimized to just `popcount (x) <= 1`.

I am going to look to see what is left in GCC 15.


More information about the Gcc-bugs mailing list