Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-12-29 05:46:58 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-12-29 05:46:58 +0400
commit85a97f64a7cbc5f17594a22ce1431520d2ff4d59 (patch)
tree33cea0e77c4bd1f3d69d638d163faef817abb84e /source/blender/blenlib
parent2ca9a6a0040f64622ad21724418cca6d0eb6789f (diff)
add UNLIKELY / LIKELY util defines to help optimize iterators that are called a lot, only defined for gcc at the moment.
also some cmake formatting edits.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r--source/blender/blenlib/BLI_utildefines.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index 94189af34fa..abe8fb7d8fe 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -300,4 +300,13 @@
# define BLI_assert(a) (void)0
#endif
+/* hints for branch pradiction, only use in code that runs a _lot_ where */
+#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 // BLI_UTILDEFINES_H