On Thu, 24 Apr 2003, Richard B. Johnson wrote:
> > Two alternatives:
> >
> > (a) !!(x & 0x400)
> >
> > (b) (x & 0x400) >> 10
> >
>
> I meant return ((foo & MASK) && 1);
>
> Try it, you'll like it! No shifts, no jumps.
Sorry, I still find !!(foo & MASK) easier to read, because !! is only used
to convert to boolean. Sort of a "boolean cast" in effect. It jumps out at
you what is intended.
Anyway, a matter of taste, both generate jumpless code.
-- bill davidsen <davidsen@tmr.com> CTO, TMR Associates, Inc Doing interesting things with little computers since 1979.- 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/
This archive was generated by hypermail 2b29 : Wed Apr 30 2003 - 22:00:22 EST