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 PLATFORM_C99_SUPPORT_WIN_H_ | 5 #ifndef PLATFORM_C99_SUPPORT_WIN_H_ |
6 #define PLATFORM_C99_SUPPORT_WIN_H_ | 6 #define PLATFORM_C99_SUPPORT_WIN_H_ |
7 | 7 |
8 // Visual C++ is missing a bunch of C99 math macros and | 8 // Visual C++ is missing a bunch of C99 math macros and |
9 // functions. Define them here. | 9 // functions. Define them here. |
10 | 10 |
11 #include <float.h> | 11 #include <float.h> |
12 | 12 |
13 static const unsigned __int64 kQuietNaNMask = | 13 static const unsigned __int64 kQuietNaNMask = |
14 static_cast<unsigned __int64>(0xfff) << 51; | 14 static_cast<unsigned __int64>(0xfff) << 51; |
15 | 15 |
| 16 |
| 17 #ifndef va_copy |
| 18 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) |
| 19 #endif /* va_copy */ |
| 20 |
| 21 |
16 #define INFINITY HUGE_VAL | 22 #define INFINITY HUGE_VAL |
17 #define NAN \ | 23 #define NAN \ |
18 *reinterpret_cast<const double*>(&kQuietNaNMask) | 24 *reinterpret_cast<const double*>(&kQuietNaNMask) |
19 | 25 |
20 static inline int isinf(double x) { | 26 static inline int isinf(double x) { |
21 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; | 27 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; |
22 } | 28 } |
23 | 29 |
24 static inline int isnan(double x) { | 30 static inline int isnan(double x) { |
25 return _isnan(x); | 31 return _isnan(x); |
(...skipping 17 matching lines...) Expand all Loading... |
43 | 49 |
44 static inline double round(double x) { | 50 static inline double round(double x) { |
45 if (x < 0) { | 51 if (x < 0) { |
46 return ceil(x - 0.5); | 52 return ceil(x - 0.5); |
47 } else { | 53 } else { |
48 return floor(x + 0.5); | 54 return floor(x + 0.5); |
49 } | 55 } |
50 } | 56 } |
51 | 57 |
52 #endif // PLATFORM_C99_SUPPORT_WIN_H_ | 58 #endif // PLATFORM_C99_SUPPORT_WIN_H_ |
OLD | NEW |