add UNLIKELY / LIKELY util defines to help optimize iterators that are called a lot...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 29 Dec 2011 01:46:58 +0000 (01:46 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 29 Dec 2011 01:46:58 +0000 (01:46 +0000)
also some cmake formatting edits.

extern/CMakeLists.txt
intern/cycles/CMakeLists.txt
source/blender/blenlib/BLI_utildefines.h
source/blender/modifiers/CMakeLists.txt
source/blender/python/intern/CMakeLists.txt

index a5dd3b168607b4b10b376a0e66fe9701307f4711..60253e08d4c1847ce982ca2fc148f341778cb45a 100644 (file)
@@ -45,7 +45,7 @@ if(WITH_BUILTIN_GLEW)
 endif()
 
 if(WITH_GAMEENGINE)
-   add_subdirectory(recastnavigation)
+       add_subdirectory(recastnavigation)
 endif()
 
 if(WITH_IMAGE_OPENJPEG AND (NOT UNIX OR APPLE))
index 3dc9ca5d284da360dc6ee4a4c45c8ed67b9d9292..114ff47663b8e6172984812099423225825571d6 100644 (file)
@@ -36,19 +36,19 @@ if(WITH_CYCLES_OPTIMIZED_KERNEL)
 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)
index 94189af34faa22831eae42c74a8bcbacb5e9a9e2..abe8fb7d8feae02cbece4e166359ce02ad0e00c6 100644 (file)
 #  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
index 87498b3bb63d8a3dfa076b70c53516fb1ae2b6c5..396e4d556d24e262711b15aff02d564817fcc590 100644 (file)
@@ -40,7 +40,7 @@ set(INC
 
 set(INC_SYS
        ${ZLIB_INCLUDE_DIRS}
-        ${GLEW_INCLUDE_PATH}
+       ${GLEW_INCLUDE_PATH}
 )
 
 set(SRC
index 1899936cb5094a0ba9e02fafe6b3f52c25ab65d2..f110576a297f484bbf1fadb4b82216d738b192c2 100644 (file)
@@ -33,7 +33,7 @@ set(INC
        ../../makesdna
        ../../makesrna
        ../../windowmanager
-    ../../gpu
+       ../../gpu
        ../../../../intern/guardedalloc
 )