Re: [PATCH] 2.4.21-rc1 pointless IDE noise reduction

Willy Tarreau (willy@w.ods.org)
Thu, 24 Apr 2003 20:27:56 +0200


Hi !

Well, although I usually don't like these endless coding-style threads, why
don't you simply use this common form ? :

return !!(foo & MASK);

I found that the compilers like it much and easily emit conditionnal set
instructions. Eg, on x86, this should be something like :

testl MASK, foo
setnz retcode

Cheers,
Willy

On Thu, Apr 24, 2003 at 01:15:39PM -0400, Timothy Miller wrote:
> >
> >
> >I meant return ((foo & MASK) && 1);
> >
> >Try it, you'll like it! No shifts, no jumps.
> >
> >
> >
>
> Looks sweet! If the compiler is smart, that is. I'll add that to my
> repetoire. I'll have to see what the asm output looks like.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/