diff include/SDL_stdinc.h @ 3012:7e30c2dc7783

Fixed Visual C++ release build for Visual C++ 2005 * Some math functions become intrinsic in release mode, so we need to convert all the math functions into SDL math functions, like we did with the stdlib functions. * Constant initializers of 8-bit values become calls to memset() in release mode, but memset() itself is an intrinsic when explicitly called. So we'll just explicitly call memset() in those cases.
author Sam Lantinga <slouken@libsdl.org>
date Sat, 10 Jan 2009 18:32:24 +0000
parents 99210400e8b9
children 77c3e67f0740
line wrap: on
line diff
--- a/include/SDL_stdinc.h	Fri Jan 09 20:43:30 2009 +0000
+++ b/include/SDL_stdinc.h	Sat Jan 10 18:32:24 2009 +0000
@@ -72,6 +72,9 @@
 #ifdef HAVE_CTYPE_H
 # include <ctype.h>
 #endif
+#ifdef HAVE_MATH_H
+# include <math.h>
+#endif
 #ifdef HAVE_ICONV_H
 # include <iconv.h>
 #endif
@@ -639,6 +642,76 @@
                                           const char *fmt, va_list ap);
 #endif
 
+#ifndef HAVE_M_PI
+#define M_PI    3.14159265358979323846264338327950288   /* pi */
+#endif
+
+#ifdef HAVE_COPYSIGN
+#define SDL_copysign    copysign
+#else
+extern DECLSPEC double SDLCALL SDL_copysign(double x, double y);
+#endif
+
+#ifdef HAVE_COS
+#define SDL_cos         cos
+#else
+extern DECLSPEC double SDLCALL SDL_cos(double x);
+#endif
+
+#ifdef HAVE_COSF
+#define SDL_cosf        cosf
+#else
+#define SDL_cosf(x) (float)SDL_cos((double)x)
+#endif
+
+#ifdef HAVE_FABS
+#define SDL_fabs        fabs
+#else
+extern DECLSPEC double SDLCALL SDL_fabs(double x);
+#endif
+
+#ifdef HAVE_FLOOR
+#define SDL_floor       floor
+#else
+extern DECLSPEC double SDLCALL SDL_floor(double x);
+#endif
+
+#ifdef HAVE_LOG
+#define SDL_log         log
+#else
+extern DECLSPEC double SDLCALL SDL_log(double x);
+#endif
+
+#ifdef HAVE_POW
+#define SDL_pow         pow
+#else
+extern DECLSPEC double SDLCALL SDL_pow(double x, double y);
+#endif
+
+#ifdef HAVE_SCALBN
+#define SDL_scalbn      scalbn
+#else
+extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n);
+#endif
+
+#ifdef HAVE_SIN
+#define SDL_sin         sin
+#else
+extern DECLSPEC double SDLCALL SDL_sin(double x);
+#endif
+
+#ifdef HAVE_SINF
+#define SDL_sinf        sinf
+#else
+#define SDL_sinf(x) (float)SDL_sin((double)x)
+#endif
+
+#ifdef HAVE_SQRT
+#define SDL_sqrt        sqrt
+#else
+extern DECLSPEC double SDLCALL SDL_sqrt(double x);
+#endif
+
 /* The SDL implementation of iconv() returns these error codes */
 #define SDL_ICONV_ERROR		(size_t)-1
 #define SDL_ICONV_E2BIG		(size_t)-2