"James Youngman" <[EMAIL PROTECTED]> wrote: > On Tue, Sep 2, 2008 at 12:06 PM, Jim Meyering <[EMAIL PROTECTED]> wrote: >> Andreas Schwab <[EMAIL PROTECTED]> wrote: >>> Jim Meyering <[EMAIL PROTECTED]> writes: >>>> Kamil Dudka <[EMAIL PROTECTED]> wrote: >>>>> +#define LOG_EQ(a,b) (((a)&&(b))||(!(a)&&!(b))) >>>> >>>> This can be written more simply as !((a) ^ (b)) >>> >>> Only if the operands are already boolean, and then you can just use a == b. >> >> Oh. Right. To be general, it'd have to be like this, >> but this is probably too obtuse unless you're comfortable >> with the "!!" pseudo operator idiom: >> >> #define LOG_EQ(a, b) !((!!(a)) ^ (!!(b))) > > Why is it necessary anyway? The result of ! is already guaranteed to > be either 1 or 0. Hence as Andreas said, > > #define LOG_EQ(a,b) (!(a) == !(b))
That looks best. Thanks! _______________________________________________ Bug-coreutils mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-coreutils
