This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR78305


Hi,

On Wed, 16 Nov 2016, Michael Matz wrote:

> > Looks good to me, thanks.
> 
> An integer X is a power of two if and only if
>   X & -X == 0  (&& X != 0 if you want to exclude zero)

Nonsense.  It's X & -X == X (or X & (X-1) == 0) of course, and doesn't 
handle negative numbers.  Still, no popcount needed.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]