diff options
author | Josh Blum <josh@joshknows.com> | 2017-01-20 09:53:02 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2017-01-30 12:34:52 -0800 |
commit | dd25086351b5e315b9e5265f0eabbac244ec918d (patch) | |
tree | a5d76a4dd123b14d8001819b795d97327f0cfe64 /cmake | |
parent | 1643272f933bf206bf3bef815bf21426f27dffcb (diff) |
cmake: updates to msvc config.h
* Remove copies of math constants and add _USE_MATH_DEFINES
to windows definitions. This should work for all MSVC versions
* Version specific ifdef for the INFINITY macro (present in msvc 2013 and up)
* Version specific ifdef for struct timespec (present in msvc 2015 and up)
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/msvc/config.h | 21 | ||||
-rw-r--r-- | cmake/msvc/sys/time.h | 2 |
2 files changed, 5 insertions, 18 deletions
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h index d3daed1587..8b12c2a47b 100644 --- a/cmake/msvc/config.h +++ b/cmake/msvc/config.h @@ -21,8 +21,8 @@ typedef ptrdiff_t ssize_t; //////////////////////////////////////////////////////////////////////// // rint functions //////////////////////////////////////////////////////////////////////// -#include <math.h> #if _MSC_VER < 1800 +#include <math.h> static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);} static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);} static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);} @@ -34,26 +34,11 @@ static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x //////////////////////////////////////////////////////////////////////// // math constants //////////////////////////////////////////////////////////////////////// -#ifndef INFINITY +#if _MSC_VER < 1800 +#include <math.h> #define INFINITY HUGE_VAL #endif -#ifndef _MATH_DEFINES_DEFINED -# define M_E 2.7182818284590452354 /* e */ -# define M_LOG2E 1.4426950408889634074 /* log_2 e */ -# define M_LOG10E 0.43429448190325182765 /* log_10 e */ -# define M_LN2 0.69314718055994530942 /* log_e 2 */ -# define M_LN10 2.30258509299404568402 /* log_e 10 */ -# define M_PI 3.14159265358979323846 /* pi */ -# define M_PI_2 1.57079632679489661923 /* pi/2 */ -# define M_PI_4 0.78539816339744830962 /* pi/4 */ -# define M_1_PI 0.31830988618379067154 /* 1/pi */ -# define M_2_PI 0.63661977236758134308 /* 2/pi */ -# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ -# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ -# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ -#endif - //////////////////////////////////////////////////////////////////////// // random and srandom //////////////////////////////////////////////////////////////////////// diff --git a/cmake/msvc/sys/time.h b/cmake/msvc/sys/time.h index 8800ed5cbf..12acc8dc31 100644 --- a/cmake/msvc/sys/time.h +++ b/cmake/msvc/sys/time.h @@ -14,6 +14,7 @@ #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif +#if _MSC_VER < 1900 struct timespec { time_t tv_sec; /* Seconds since 00:00:00 GMT, */ @@ -25,6 +26,7 @@ long tv_nsec; /* Additional nanoseconds since */ /* tv_sec */ }; +#endif struct timezone { |