Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Side by Side Diff: runtime/platform/c99_support_win.h

Issue 353403004: Fixes Android build by using C++ math header instead of C one. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #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 static const unsigned __int64 kQuietNaNMask = 16 static const unsigned __int64 kQuietNaNMask =
17 static_cast<unsigned __int64>(0xfff) << 51; 17 static_cast<unsigned __int64>(0xfff) << 51;
18 18
19 19
20 #ifndef va_copy 20 #ifndef va_copy
21 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst))) 21 #define va_copy(dst, src) (memmove(&(dst), &(src), sizeof(dst)))
22 #endif /* va_copy */ 22 #endif /* va_copy */
23 23
24 24
25 #define INFINITY HUGE_VAL 25 #define INFINITY HUGE_VAL
26 #define NAN \ 26 #define NAN \
27 *reinterpret_cast<const double*>(&kQuietNaNMask) 27 *reinterpret_cast<const double*>(&kQuietNaNMask)
28 28
29 namespace std {
30
29 static inline int isinf(double x) { 31 static inline int isinf(double x) {
30 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0; 32 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0;
31 } 33 }
32 34
33 static inline int isnan(double x) { 35 static inline int isnan(double x) {
34 return _isnan(x); 36 return _isnan(x);
35 } 37 }
36 38
37 static inline int signbit(double x) { 39 static inline int signbit(double x) {
38 if (x == 0) { 40 if (x == 0) {
39 return _fpclass(x) & _FPCLASS_NZ; 41 return _fpclass(x) & _FPCLASS_NZ;
40 } else { 42 } else {
41 return x < 0; 43 return x < 0;
42 } 44 }
43 } 45 }
44 46
47 } // namespace std
48
45 static inline double trunc(double x) { 49 static inline double trunc(double x) {
46 if (x < 0) { 50 if (x < 0) {
47 return ceil(x); 51 return ceil(x);
48 } else { 52 } else {
49 return floor(x); 53 return floor(x);
50 } 54 }
51 } 55 }
52 56
53 static inline double round(double x) { 57 static inline double round(double x) {
54 if (!_finite(x)) { 58 if (!_finite(x)) {
(...skipping 13 matching lines...) Expand all
68 } 72 }
69 73
70 // Windows does not have strtoll defined. 74 // Windows does not have strtoll defined.
71 #if defined(_MSC_VER) 75 #if defined(_MSC_VER)
72 #define strtoll _strtoi64 76 #define strtoll _strtoi64
73 #endif 77 #endif
74 78
75 #endif 79 #endif
76 80
77 #endif // PLATFORM_C99_SUPPORT_WIN_H_ 81 #endif // PLATFORM_C99_SUPPORT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698