[Bf-blender-cvs] [9e402f8] soc-2014-viewport_fx: BLI_restrict macro to help the compiler optimize functions that do not allow pointer aliasing.

Jason Wilkins noreply at git.blender.org
Wed Jun 25 23:42:45 CEST 2014


Commit: 9e402f8866794eadd49e5a024bed532ab6cf7b19
Author: Jason Wilkins
Date:   Wed Jun 25 16:11:46 2014 -0500
https://developer.blender.org/rB9e402f8866794eadd49e5a024bed532ab6cf7b19

BLI_restrict macro to help the compiler optimize functions that do not allow pointer aliasing.

===================================================================

M	source/blender/blenlib/BLI_utildefines.h

===================================================================

diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h
index f164b55..454546a 100644
--- a/source/blender/blenlib/BLI_utildefines.h
+++ b/source/blender/blenlib/BLI_utildefines.h
@@ -500,4 +500,18 @@
 #  define UNLIKELY(x)     (x)
 #endif
 
+/* Are restricted pointers available? (C99) */
+#if (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
+	/* Not a C99 compiler */
+#  ifdef __GNUC__
+#    define BLI_restrict __restrict__
+#  elif defined(_MSC_VER) && _MSC_VER >= 1400
+#    define BLI_restrict __restrict
+#  else
+#    define BLI_restrict
+#  endif
+#else
+#  define BLI_restrict restrict
+#endif
+
 #endif  /* __BLI_UTILDEFINES_H__ */




More information about the Bf-blender-cvs mailing list