Just for my curiosity .. is there any benchmark that shows that this actually improves something
re, wh Am 12.05.2015 06:23, schrieb Keith Packard: > These two macros provide hints to the compiler about common code paths > to help it optimize a bit better. > > Signed-off-by: Keith Packard <kei...@keithp.com> > --- > include/misc.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/include/misc.h b/include/misc.h > index 9b1c03a..74889f5 100644 > --- a/include/misc.h > +++ b/include/misc.h > @@ -291,6 +291,14 @@ version_compare(uint32_t a_major, uint32_t a_minor, > #define SwapRestL(stuff) \ > SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff)) > > +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) > +#define likely(expr) (__builtin_expect (!!(expr), 1)) > +#define unlikely(expr) (__builtin_expect (!!(expr), 0)) > +#else > +#define likely(expr) (expr) > +#define unlikely(expr) (expr) > +#endif > + > #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ > >= 3)) > void __attribute__ ((error("wrong sized variable passed to swap"))) > wrong_size(void); _______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel