From b7e0da1d7fa9f3d49f964034bdfc08f47d7a1c34 Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Tue, 20 Jul 2010 18:59:52 +0000 Subject: [PATCH] 2010-07-20 Zoltan Varga * src/glib.h (G_LIKELY): Implement these for gcc properly. svn path=/trunk/mono/; revision=160630 --- eglib/ChangeLog | 6 +++++- eglib/src/glib.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/eglib/ChangeLog b/eglib/ChangeLog index 159a881ef89..1e67d88695c 100644 --- a/eglib/ChangeLog +++ b/eglib/ChangeLog @@ -1,7 +1,11 @@ +2010-07-20 Zoltan Varga + + * src/glib.h (G_LIKELY): Implement these for gcc properly. + 2010-07-19 Miguel de Icaza * src/gmisc-win32.c (g_getenv): Distinguish between variable not - found and an empty variable. + found and an empty variable. This should fix 566152 diff --git a/eglib/src/glib.h b/eglib/src/glib.h index ae931dd1400..b56f3957255 100644 --- a/eglib/src/glib.h +++ b/eglib/src/glib.h @@ -607,9 +607,13 @@ gint g_unichar_xdigit_value (gunichar c); #define CLAMP(a,low,high) (((a) < (low)) ? (low) : (((a) > (high)) ? (high) : (a))) #endif -/* FIXME: Implement these two for gcc */ +#if defined(__GNUC__) && (__GNUC__ > 2) +#define G_LIKELY(expr) (__builtin_expect ((expr) != 0, 1)) +#define G_UNLIKELY(expr) (__builtin_expect ((expr) != 0, 0)) +#else #define G_LIKELY(x) (x) #define G_UNLIKELY(x) (x) +#endif /* * Unicode conversion -- 2.25.1