On 09/08/2016 02:59 PM, Jason Merrill wrote:
On Thu, Sep 8, 2016 at 11:55 AM, Joseph Myers wrote:
> On Thu, 8 Sep 2016, Jason Merrill wrote:
>
>> Various places in GCC use negate, bit-and and compare to test whether
>> an integer is a power of 2, but I think it would be clearer for this
>> tes
On Thu, Sep 8, 2016 at 11:55 AM, Joseph Myers wrote:
> On Thu, 8 Sep 2016, Jason Merrill wrote:
>
>> Various places in GCC use negate, bit-and and compare to test whether
>> an integer is a power of 2, but I think it would be clearer for this
>> test to be wrapped in a function.
>
> (x & -x) == x
On Thu, 8 Sep 2016, Jason Merrill wrote:
> Various places in GCC use negate, bit-and and compare to test whether
> an integer is a power of 2, but I think it would be clearer for this
> test to be wrapped in a function.
(x & -x) == x is also true for 0. Whatever the correct function semantics
f
On Thu, Sep 08, 2016 at 08:53:26AM -0600, Jeff Law wrote:
> On 09/07/2016 11:56 PM, Jason Merrill wrote:
> > Various places in GCC use negate, bit-and and compare to test whether
> > an integer is a power of 2, but I think it would be clearer for this
> > test to be wrapped in a function.
> >
> >
On 09/07/2016 11:56 PM, Jason Merrill wrote:
Various places in GCC use negate, bit-and and compare to test whether
an integer is a power of 2, but I think it would be clearer for this
test to be wrapped in a function.
OK for trunk?
I think the canonical way we've written that is
exact_log2 (x
Various places in GCC use negate, bit-and and compare to test whether
an integer is a power of 2, but I think it would be clearer for this
test to be wrapped in a function.
OK for trunk?
commit e2ca9914ce46d56775854f50c21506b220fd50b6
Author: Jason Merrill
Date: Wed Sep 7 16:22:32 2016 -0400