[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54087] trunk/blender/source/blender/ blenlib/BLI_math_base.h: Do not redefine math functions for floats if compiler complies with C99 or POSIX .1-2001
Sv. Lockal
lockalsash at gmail.com
Thu Jan 24 21:54:15 CET 2013
Revision: 54087
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54087
Author: lockal
Date: 2013-01-24 20:54:12 +0000 (Thu, 24 Jan 2013)
Log Message:
-----------
Do not redefine math functions for floats if compiler complies with C99 or POSIX.1-2001
This is useful for gcc which does not define sqrtf/powf/... functions with preprocessor and therefore always used sqrt/pow/...
Float functions are generally 20-50% faster than their equivalents for double type.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_base.h
Modified: trunk/blender/source/blender/blenlib/BLI_math_base.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_base.h 2013-01-24 19:31:44 UTC (rev 54086)
+++ trunk/blender/source/blender/blenlib/BLI_math_base.h 2013-01-24 20:54:12 UTC (rev 54087)
@@ -80,6 +80,9 @@
#define MAXFLOAT ((float)3.40282347e+38)
#endif
+/* do not redefine functions from C99 or POSIX.1-2001 */
+#if !(defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L)
+
#ifndef sqrtf
#define sqrtf(a) ((float)sqrt(a))
#endif
@@ -129,6 +132,8 @@
#define hypotf(a, b) ((float)hypot(a, b))
#endif
+#endif
+
#ifdef WIN32
# ifndef FREE_WINDOWS
# define isnan(n) _isnan(n)
More information about the Bf-blender-cvs
mailing list