Re: RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-16 Thread Jeff Law
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

Re: RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-08 Thread Jason Merrill
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

Re: RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-08 Thread Joseph Myers
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

Re: RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-08 Thread Jakub Jelinek
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. > > > >

Re: RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-08 Thread Jeff Law
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

RFA: Small PATCH to add pow2p_hwi to hwint.h

2016-09-07 Thread Jason Merrill
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