[Bf-blender-cvs] [7ad9b13] blender-v2.72-release: Use native float math functions for MSVC12

Sv. Lockal noreply at git.blender.org
Fri Oct 3 15:24:39 CEST 2014


Commit: 7ad9b13b54d18026a9d0aa09bfb31ed70e5e934d
Author: Sv. Lockal
Date:   Tue Sep 30 13:27:56 2014 +0400
Branches: blender-v2.72-release
https://developer.blender.org/rB7ad9b13b54d18026a9d0aa09bfb31ed70e5e934d

Use native float math functions for MSVC12

`double` surrogates are slow (e.g. pow is 2x slower than powf), and MSVC12
supports fp-math functions from C99.

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

M	source/blender/blenlib/BLI_math_base.h

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

diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h
index 5f94f04..494bc40 100644
--- a/source/blender/blenlib/BLI_math_base.h
+++ b/source/blender/blenlib/BLI_math_base.h
@@ -83,8 +83,8 @@ static const int NAN_INT = 0x7FC00000;
 #  define NAN_FLT  (*((float *)(&NAN_INT)))
 #endif
 
-/* do not redefine functions from C99 or POSIX.1-2001 */
-#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L))
+/* do not redefine functions from C99, POSIX.1-2001 or MSVC12 (partial C99) */
+#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L) || (defined(_MSC_VER) && _MSC_VER >= 1800))
 
 #ifndef sqrtf
 #define sqrtf(a) ((float)sqrt(a))
@@ -138,7 +138,7 @@ static const int NAN_INT = 0x7FC00000;
 #define copysignf(a, b) ((float)copysign(a, b))
 #endif
 
-#endif  /* C99 or POSIX.1-2001 */
+#endif  /* C99, POSIX.1-2001 or MSVC12 (partial C99) */
 
 #ifdef WIN32
 #  if defined(_MSC_VER)




More information about the Bf-blender-cvs mailing list