[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42957] trunk/blender: add UNLIKELY / LIKELY util defines to help optimize iterators that are called a lot, only defined for gcc at the moment.

Campbell Barton ideasman42 at gmail.com
Thu Dec 29 02:46:59 CET 2011


Revision: 42957
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42957
Author:   campbellbarton
Date:     2011-12-29 01:46:58 +0000 (Thu, 29 Dec 2011)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/extern/CMakeLists.txt
    trunk/blender/intern/cycles/CMakeLists.txt
    trunk/blender/source/blender/blenlib/BLI_utildefines.h
    trunk/blender/source/blender/modifiers/CMakeLists.txt
    trunk/blender/source/blender/python/intern/CMakeLists.txt

Modified: trunk/blender/extern/CMakeLists.txt
===================================================================
--- trunk/blender/extern/CMakeLists.txt	2011-12-29 01:38:11 UTC (rev 42956)
+++ trunk/blender/extern/CMakeLists.txt	2011-12-29 01:46:58 UTC (rev 42957)
@@ -45,7 +45,7 @@
 endif()
 
 if(WITH_GAMEENGINE)
-   add_subdirectory(recastnavigation)
+	add_subdirectory(recastnavigation)
 endif()
 
 if(WITH_IMAGE_OPENJPEG AND (NOT UNIX OR APPLE))

Modified: trunk/blender/intern/cycles/CMakeLists.txt
===================================================================
--- trunk/blender/intern/cycles/CMakeLists.txt	2011-12-29 01:38:11 UTC (rev 42956)
+++ trunk/blender/intern/cycles/CMakeLists.txt	2011-12-29 01:46:58 UTC (rev 42957)
@@ -36,19 +36,19 @@
 endif()
 
 if(WITH_CYCLES_NETWORK)
-  add_definitions(-DWITH_NETWORK)
+	add_definitions(-DWITH_NETWORK)
 endif()
 
 if(WITH_CYCLES_OSL)
-  add_definitions(-DWITH_OSL)
+	add_definitions(-DWITH_OSL)
 endif()
 
 if(WITH_CYCLES_PARTIO)
-  add_definitions(-DWITH_PARTIO)
+	add_definitions(-DWITH_PARTIO)
 endif()
 
 if(WITH_CYCLES_CUDA_BINARIES)
-  add_definitions(-DWITH_CUDA_BINARIES)
+	add_definitions(-DWITH_CUDA_BINARIES)
 endif()
 
 add_definitions(-DWITH_OPENCL)

Modified: trunk/blender/source/blender/blenlib/BLI_utildefines.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_utildefines.h	2011-12-29 01:38:11 UTC (rev 42956)
+++ trunk/blender/source/blender/blenlib/BLI_utildefines.h	2011-12-29 01:46:58 UTC (rev 42957)
@@ -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

Modified: trunk/blender/source/blender/modifiers/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/modifiers/CMakeLists.txt	2011-12-29 01:38:11 UTC (rev 42956)
+++ trunk/blender/source/blender/modifiers/CMakeLists.txt	2011-12-29 01:46:58 UTC (rev 42957)
@@ -40,7 +40,7 @@
 
 set(INC_SYS
 	${ZLIB_INCLUDE_DIRS}
-        ${GLEW_INCLUDE_PATH}
+	${GLEW_INCLUDE_PATH}
 )
 
 set(SRC

Modified: trunk/blender/source/blender/python/intern/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/python/intern/CMakeLists.txt	2011-12-29 01:38:11 UTC (rev 42956)
+++ trunk/blender/source/blender/python/intern/CMakeLists.txt	2011-12-29 01:46:58 UTC (rev 42957)
@@ -33,7 +33,7 @@
 	../../makesdna
 	../../makesrna
 	../../windowmanager
-    ../../gpu
+	../../gpu
 	../../../../intern/guardedalloc
 )
 




More information about the Bf-blender-cvs mailing list