[Intel-gfx] [PATCH 5/5] intel: Mark checks for debug printing as unlikely.
Eric Anholt
eric at anholt.net
Tue Jun 18 22:32:57 CEST 2013
There is a very tiny change (-120 bytes) in compiled code size as a
result.
---
intel/intel_bufmgr_gem.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/intel/intel_bufmgr_gem.c b/intel/intel_bufmgr_gem.c
index b72a30b..ee73857 100644
--- a/intel/intel_bufmgr_gem.c
+++ b/intel/intel_bufmgr_gem.c
@@ -76,8 +76,18 @@
#define VG_CLEAR(s) VG(memset(&s, 0, sizeof(s)))
+#ifndef likely
+# ifdef __GNUC__
+# define likely(x) __builtin_expect(!!(x), 1)
+# define unlikely(x) __builtin_expect(!!(x), 0)
+# else
+# define likely(x) (x)
+# define unlikely(x) (x)
+# endif
+#endif
+
#define DBG(...) do { \
- if (bufmgr_gem->bufmgr.debug) \
+ if (unlikely(bufmgr_gem->bufmgr.debug)) \
fprintf(stderr, __VA_ARGS__); \
} while (0)
--
1.8.3.rc0
More information about the Intel-gfx
mailing list