comparison dmd/mtype.c @ 1008:4c20df3837f9

Preparation for next patch. Don't ask about why this is needed. I hate the preprocessor. Let's just leave it at that.
author Frits van Bommel <fvbommel wxs.nl>
date Sat, 28 Feb 2009 16:09:35 +0100
parents 132bece5ae62
children b1b23a64ad8c
comparison
equal deleted inserted replaced
1006:132bece5ae62 1008:4c20df3837f9
13 13
14 #if (defined (__SVR4) && defined (__sun)) 14 #if (defined (__SVR4) && defined (__sun))
15 #include <alloca.h> 15 #include <alloca.h>
16 #endif 16 #endif
17 17
18 #include <math.h> 18 #include <cmath>
19 19
20 #include <stdio.h> 20 #include <stdio.h>
21 #include <assert.h> 21 #include <assert.h>
22 #include <float.h> 22 #include <float.h>
23 23
36 #else 36 #else
37 //#define signbit 56 37 //#define signbit 56
38 #endif 38 #endif
39 39
40 #if __APPLE__ 40 #if __APPLE__
41 #include <math.h>
42 static double zero = 0; 41 static double zero = 0;
43 #elif __MINGW32__ 42 #elif __MINGW32__
44 #include <math.h>
45 static double zero = 0; 43 static double zero = 0;
46 #elif __GNUC__ 44 #elif __GNUC__
47 #include <math.h>
48 #if !(defined (__SVR4) && defined (__sun)) 45 #if !(defined (__SVR4) && defined (__sun))
49 #include <bits/nan.h> 46 #include <bits/nan.h>
50 #include <bits/mathdef.h> 47 #include <bits/mathdef.h>
51 #endif 48 #endif
52 static double zero = 0; 49 static double zero = 0;
1132 // gcc nan's have the sign bit set by default, so turn it off 1129 // gcc nan's have the sign bit set by default, so turn it off
1133 // Need the volatile to prevent gcc from doing incorrect 1130 // Need the volatile to prevent gcc from doing incorrect
1134 // constant folding. 1131 // constant folding.
1135 volatile d_float80 foo; 1132 volatile d_float80 foo;
1136 foo = NAN; 1133 foo = NAN;
1137 if (signbit(foo)) // signbit sometimes, not always, set 1134 if (std::signbit(foo)) // signbit sometimes, not always, set
1138 foo = -foo; // turn off sign bit 1135 foo = -foo; // turn off sign bit
1139 fvalue = foo; 1136 fvalue = foo;
1140 #elif _MSC_VER 1137 #elif _MSC_VER
1141 unsigned long nan[2]= { 0xFFFFFFFF, 0x7FFFFFFF }; 1138 unsigned long nan[2]= { 0xFFFFFFFF, 0x7FFFFFFF };
1142 fvalue = *(double*)nan; 1139 fvalue = *(double*)nan;