GEOS: platform.h Source File

GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

platform.h
1 /* include/geos/platform.h. Generated from platform.h.in by configure. */
2 #ifndef GEOS_PLATFORM_H
3 #define GEOS_PLATFORM_H
4
5 /* Set to 1 if you have `int64_t' type */
6 /* #undef HAVE_INT64_T_64 */
7
8 /* Set to 1 if `long int' is 64 bits */
9 #define HAVE_LONG_INT_64 1
10
11 /* Set to 1 if `long long int' is 64 bits */
12 /* #undef HAVE_LONG_LONG_INT_64 */
13
14 /* Set to 1 if you have ieeefp.h */
15 #define HAVE_IEEEFP_H 1
16
17 /* Has finite */
18 #define HAVE_FINITE 1
19
20 /* Has isfinite */
21 #define HAVE_ISFINITE 1
22
23 /* Has isnan */
24 /* #undef HAVE_ISNAN */
25
26 #ifdef HAVE_IEEEFP_H
27 extern "C"
28 {
29 #include <ieeefp.h>
30 }
31 #endif
32
33 #ifdef HAVE_INT64_T_64
34 extern "C"
35 {
36 #include <inttypes.h>
37 }
38 #endif
39
40 #if defined(__GNUC__) && defined(_WIN32)
41 /* For MingW the appropriate definitions are included in
42 math.h and float.h but the definitions in
43 math.h are only included if __STRICT_ANSI__
44 is not defined. Since GEOS is compiled with -ansi that
45 means those definitions are not available. */
46 #include <float.h>
47 #endif
48
49 #include <limits> // for std::numeric_limits
50
51
52
53 //Defines NaN for intel platforms
54 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
55
56 //Don't forget to define infinities
57 #define DoubleInfinity std::numeric_limits<double>::infinity()
58 #define DoubleNegInfinity -std::numeric_limits<double>::infinity()
59
60 #define DoubleMax std::numeric_limits<double>::max()
61
62 #ifdef HAVE_INT64_T_64
63 typedef int64_t int64;
64 #else
65 # ifdef HAVE_LONG_LONG_INT_64
66 typedef long long int int64;
67 # else
68 typedef long int int64;
69 # ifndef HAVE_LONG_INT_64
70 # define INT64_IS_REALLY32 1
71 # warning "Could not find 64bit integer definition!"
72 # endif
73 # endif
74 #endif
75
76
77 #if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
78 # define FINITE(x) (finite(x))
79 #else
80 # if defined(_MSC_VER)
81 # define FINITE(x) _finite(static_cast<double>(x))
82 # else
83 # define FINITE(x) (isfinite(x))
84 # endif
85 #endif
86
87 #if defined(HAVE_ISNAN)
88 # define ISNAN(x) (isnan(x))
89 #else
90 # if defined(_MSC_VER)
91 # define ISNAN(x) _isnan(x)
92 # elif defined(__MINGW32__)
93 // sandro furieri: sanitizing MinGW32
94 # define ISNAN(x) (std::isnan(x))
95 # elif defined(__OSX__) || defined(__APPLE__) || defined(__OpenBSD__)
96 // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
97 // It does leave a version in std.
98 # define ISNAN(x) (std::isnan(x))
99 # elif defined(__sun) || defined(__sun__)
100 # include <math.h>
101 # define ISNAN(x) (::isnan(x))
102 # endif
103 #endif
104
105 #ifndef FINITE
106 #error "Can not compile without finite or isfinite function or macro"
107 #endif
108
109 #ifndef ISNAN
110 #error "Can not compile without isnan function or macro"
111 #endif
112
113 #endif