|> Andi Kleen <ak@suse.de> writes:
|>
|> > Good point. I somehow assumed that __builtin_expect would just signify
|> > a boolean, but if I read gcc source correctly this was wrong.
|>
|> Yeh, it's a long so you'll get no cast warnings too.
|>
|> > Here is an updated patch.
|>
|> [snip ... ]
|>
|> > --- include/linux/kernel.h-LIKELY Tue Sep 18 11:12:20 2001
|> > +++ include/linux/kernel.h Tue Sep 18 14:35:17 2001
|> > @@ -171,4 +171,14 @@
|> > char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
|> > };
|> >
|> > +
|> > +/* This loses on a few early 2.96 snapshots, but hopefully nobody uses them anymore. */
|> > +#if __GNUC__ > 2 || (__GNUC__ == 2 && _GNUC_MINOR__ == 96)
|> > +#define likely(x) __builtin_expect(!!(x), 1)
|> > +#define unlikely(x) __builtin_expect((x), 0)
|>
|> unlikely() also needs to be...
|>
|> #define unlikely(x) __builtin_expect(!(x), 1)
|>
|> ...or...
|>
|> #define unlikely(x) __builtin_expect(!!(x), 0)
This is not needed, since only 0 is the likely value and !! does not
change that.
Andreas.
-- Andreas Schwab "And now for something Andreas.Schwab@suse.de completely different." SuSE Labs, SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 - 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/