|
14 | 14 | #include <set> |
15 | 15 | #include <cassert> |
16 | 16 | #include <cstring> |
17 | | -#include <cstdio> |
18 | | - |
19 | | -#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0 |
20 | | -#include <float.h> |
21 | | -#define isfinite _finite |
22 | | -#elif defined(__sun) && defined(__SVR4) //Solaris |
23 | | -#if !defined(isfinite) |
24 | | -#include <ieeefp.h> |
25 | | -#define isfinite finite |
26 | | -#endif |
27 | | -#elif defined(_AIX) |
28 | | -#if !defined(isfinite) |
29 | | -#include <math.h> |
30 | | -#define isfinite finite |
31 | | -#endif |
32 | | -#elif defined(__hpux) |
33 | | -#if !defined(isfinite) |
34 | | -#if defined(__ia64) && !defined(finite) |
35 | | -#define isfinite(x) ((sizeof(x) == sizeof(float) ? \ |
36 | | - _Isfinitef(x) : _IsFinite(x))) |
37 | | -#else |
38 | | -#include <math.h> |
39 | | -#define isfinite finite |
40 | | -#endif |
41 | | -#endif |
42 | | -#else |
43 | | -#include <cmath> |
44 | | -#if !(defined(__QNXNTO__)) // QNX already defines isfinite |
45 | | -#define isfinite std::isfinite |
46 | | -#endif |
47 | | -#endif |
48 | 17 |
|
49 | | -#if defined(_MSC_VER) |
50 | | -#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above |
51 | | -#define snprintf sprintf_s |
52 | | -#elif _MSC_VER >= 1900 // VC++ 14.0 and above |
53 | | -#define snprintf std::snprintf |
54 | | -#else |
55 | | -#define snprintf _snprintf |
56 | | -#endif |
57 | | -#elif defined(__ANDROID__) || defined(__QNXNTO__) |
58 | | -#define snprintf snprintf |
59 | | -#elif __cplusplus >= 201103L |
60 | | -#if !defined(__MINGW32__) && !defined(__CYGWIN__) |
61 | | -#define snprintf std::snprintf |
62 | | -#endif |
63 | | -#endif |
| 18 | +#if __cplusplus >= 201103L |
| 19 | + #include <cmath> |
| 20 | + #include <cstdio> |
64 | 21 |
|
65 | | -#if defined(__BORLANDC__) |
66 | | -#include <float.h> |
67 | | -#define isfinite _finite |
68 | | -#define snprintf _snprintf |
69 | | -#endif |
| 22 | + #if !defined(isnan) |
| 23 | + #define isnan std::isnan |
| 24 | + #endif |
70 | 25 |
|
71 | | -#if defined(_MSC_VER) && !defined(__clang__) |
72 | | -#if _MSC_VER >= 1900 && defined(_WIN64) |
73 | | -#include <math.h> |
74 | | -#define isnan _isnanf |
75 | | -#else |
76 | | -#include <float.h> |
77 | | -#define isnan _isnan |
78 | | -#endif |
79 | | -#elif __cplusplus >= 201103L |
80 | | -#include <cmath> |
81 | | -#define isnan std::isnan |
| 26 | + #if !defined(isfinite) |
| 27 | + #define isfinite std::isfinite |
| 28 | + #endif |
| 29 | + |
| 30 | + #if !defined(snprintf) |
| 31 | + #define snprintf std::snprintf |
| 32 | + #endif |
82 | 33 | #else |
83 | | -#include <math.h> |
84 | | -#if !define(isnan) |
85 | | -// IEEE standard states that NaN values will not compare to themselves |
86 | | -#define isnan(x) (x!=x) |
87 | | -#endif |
| 34 | + #include <math.h> |
| 35 | + #include <stdio.h> |
| 36 | + |
| 37 | + #if defined(_MSC_VER) |
| 38 | + #if !defined(isnan) |
| 39 | + #include <float.h> |
| 40 | + #define isnan _isnan |
| 41 | + #endif |
| 42 | + |
| 43 | + #if !defined(isfinite) |
| 44 | + #include <float.h> |
| 45 | + #define isfinite _finite |
| 46 | + #endif |
| 47 | + |
| 48 | + #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1 |
| 49 | + #if !defined(snprintf) |
| 50 | + #define snprintf _snprintf |
| 51 | + #endif |
| 52 | + #endif |
| 53 | + |
| 54 | + #if defined(__sun) && defined(__SVR4) //Solaris |
| 55 | + #if !defined(isfinite) |
| 56 | + #include <ieeefp.h> |
| 57 | + #define isfinite finite |
| 58 | + #endif |
| 59 | + #endif |
| 60 | + |
| 61 | + #if defined(__hpux) |
| 62 | + #if !defined(isfinite) |
| 63 | + #if defined(__ia64) && !defined(finite) |
| 64 | + #define isfinite(x) ((sizeof(x) == sizeof(float) ? _Isfinitef(x) : _IsFinite(x))) |
| 65 | + #endif |
| 66 | + #endif |
| 67 | + #endif |
| 68 | + |
| 69 | + #if !defined(isnan) |
| 70 | + // IEEE standard states that NaN values will not compare to themselves |
| 71 | + #define isnan(x) (x!=x) |
| 72 | + #endif |
| 73 | + |
| 74 | + #if !defined(isfinite) |
| 75 | + #define isfinite finite |
| 76 | + #endif |
88 | 77 | #endif |
89 | 78 |
|
90 | 79 | #if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 |
|
0 commit comments