OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ | 5 #ifndef RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ |
6 #define RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ | 6 #define RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ |
7 | 7 |
8 #if defined(_MSC_VER) && (_MSC_VER < 1800) | 8 #if defined(_MSC_VER) && (_MSC_VER < 1800) |
9 | 9 |
10 // Before Visual Studio 2013 Visual C++ was missing a bunch of C99 math macros | 10 // Before Visual Studio 2013 Visual C++ was missing a bunch of C99 math macros |
11 // and functions. Define them here. | 11 // and functions. Define them here. |
12 | 12 |
13 #include <float.h> | 13 #include <float.h> |
14 #include <string.h> | 14 #include <string.h> |
15 | 15 |
16 #include <cmath> | 16 #include <cmath> |
17 | 17 |
18 static const unsigned __int64 kQuietNaNMask = | 18 static const unsigned __int64 kQuietNaNMask = |
19 static_cast<unsigned __int64>(0xfff) << 51; | 19 static_cast<unsigned __int64>(0xfff) << 51; |
20 | 20 |
21 | 21 |
22 #ifndef va_copy | 22 #ifndef va_copy |
23 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) | 23 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) |
24 #endif /* va_copy */ | 24 #endif /* va_copy */ |
25 | 25 |
26 | 26 |
27 #define NAN \ | 27 #define NAN *reinterpret_cast<const double*>(&kQuietNaNMask) |
28 *reinterpret_cast<const double*>(&kQuietNaNMask) | |
29 | 28 |
30 namespace std { | 29 namespace std { |
31 | 30 |
32 static inline int isinf(double x) { | 31 static inline int isinf(double x) { |
33 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; | 32 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; |
34 } | 33 } |
35 | 34 |
36 static inline int isnan(double x) { | 35 static inline int isnan(double x) { |
37 return _isnan(x); | 36 return _isnan(x); |
38 } | 37 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 72 } |
74 | 73 |
75 // Windows does not have strtoll defined. | 74 // Windows does not have strtoll defined. |
76 #if defined(_MSC_VER) | 75 #if defined(_MSC_VER) |
77 #define strtoll _strtoi64 | 76 #define strtoll _strtoi64 |
78 #endif | 77 #endif |
79 | 78 |
80 #endif | 79 #endif |
81 | 80 |
82 #endif // RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ | 81 #endif // RUNTIME_PLATFORM_C99_SUPPORT_WIN_H_ |
OLD | NEW |