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

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

Issue 9114008: Introduce runtime/platform directory for code shared between vm (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 11 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 #ifndef VM_C99_SUPPORT_WIN_H_
6 #define VM_C99_SUPPORT_WIN_H_
7
8 // Visual C++ is missing a bunch of C99 math macros and
9 // functions. Define them here.
10
11 #include <float.h>
12
13 static const unsigned __int64 kQuietNaNMask =
14 static_cast<unsigned __int64>(0xfff) << 51;
15
16 #define INFINITY HUGE_VAL
17 #define NAN \
18 *reinterpret_cast<const double*>(&kQuietNaNMask)
19
20 static inline int isinf(double x) {
21 return (_fpclass(x) & (_FPCLASS_PINF | _FPCLASS_NINF)) != 0;
22 }
23
24 static inline int isnan(double x) {
25 return _isnan(x);
26 }
27
28 static inline int signbit(double x) {
29 if (x == 0) {
30 return _fpclass(x) & _FPCLASS_NZ;
31 } else {
32 return x < 0;
33 }
34 }
35
36 static inline double trunc(double x) {
37 if (x < 0) {
38 return ceil(x);
39 } else {
40 return floor(x);
41 }
42 }
43
44 static inline double round(double x) {
45 if (x < 0) {
46 return ceil(x - 0.5);
47 } else {
48 return floor(x + 0.5);
49 }
50 }
51
52 #endif // VM_C99_SUPPORT_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698