From 6243a5dc340875597cf64b8e1a6c1eb5840b2b72 Mon Sep 17 00:00:00 2001 From: Damien Lespiau Date: Mon, 3 May 2010 20:41:17 +0200 Subject: [PATCH] debug: Use G_UNLIKELY in the tests Debugging code is not meant to be run in the nominal code path. Use G_UNLIKELY to be reduce the number of bubbles in the instruction pipeline. Took the opportunity to re-indent the macros. --- cogl/cogl-debug.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h index c3e197381..2537b26cd 100644 --- a/cogl/cogl-debug.h +++ b/cogl/cogl-debug.h @@ -52,18 +52,18 @@ typedef enum { #ifdef COGL_ENABLE_DEBUG #ifdef __GNUC__ -#define COGL_NOTE(type,x,a...) G_STMT_START { \ - if (cogl_debug_flags & COGL_DEBUG_##type) { \ - g_message ("[" #type "] " G_STRLOC ": " x, ##a); \ - } } G_STMT_END +#define COGL_NOTE(type,x,a...) G_STMT_START { \ + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \ + g_message ("[" #type "] " G_STRLOC ": " x, ##a); \ + } } G_STMT_END #else -#define COGL_NOTE(type,...) G_STMT_START { \ - if (cogl_debug_flags & COGL_DEBUG_##type) { \ - char *_fmt = g_strdup_printf (__VA_ARGS__); \ - g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \ - g_free (_fmt); \ - } } G_STMT_END +#define COGL_NOTE(type,...) G_STMT_START { \ + if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \ + char *_fmt = g_strdup_printf (__VA_ARGS__); \ + g_message ("[" #type "] " G_STRLOC ": %s", _fmt); \ + g_free (_fmt); \ + } } G_STMT_END #endif /* __GNUC__ */