On 17/05/2023 3:22 pm, Jan Beulich wrote: > There's no real need for the associated probing - we can easily convert > to a uniform value without knowing the specific behavior (note also that > the respective comments weren't fully correct and have gone stale). All > we (need to) depend upon is unary ! producing 0 or 1 (and never -1). > > For all present purposes yielding a value with all bits set is more > useful. > > No difference in generated code. > > Signed-off-by: Jan Beulich <jbeul...@suse.com> > --- > Unlike in C, there's also binary ! in assembly expressions, and even > binary !!. But those don't get in the way here.
I had been wanting to do this for a while, but IMO a clearer expression is to take ((x) & 1) to discard the sign. It doesn't change any of the logic to use +1 (I don't think), and it's definitely the more common way for the programmer to think. ~Andrew