GEOS 3.6.2
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/* #undef HAVE_LONG_INT_64 */
10
11/* Set to 1 if `long long int' is 64 bits */
12#define HAVE_LONG_LONG_INT_64 1
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#define HAVE_ISNAN 1
25
26#ifdef HAVE_IEEEFP_H
27extern "C"
28{
29#include <ieeefp.h>
30}
31#endif
32
33#ifdef HAVE_INT64_T_64
34extern "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# elif defined(__hpux__) && defined(__ia64__)
83# define FINITE(x) (_Isfinite(x))
84# else
85# define FINITE(x) (isfinite(x))
86# endif
87#endif
88
89#if defined(HAVE_ISNAN)
90# define ISNAN(x) (std::isnan(x))
91#else
92# if defined(_MSC_VER)
93# define ISNAN(x) _isnan(x)
94# elif defined(__MINGW32__) || defined(__CYGWIN__)
95// sandro furieri: sanitizing MinGW32
96# define ISNAN(x) (std::isnan(x))
97# elif defined(__OSX__) || defined(__APPLE__) || \
98 defined(__NetBSD__) || defined(__DragonFly__) || defined (__OpenBSD__) || \
99 (defined(__sun) && defined(__GNUC__))
100 // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
101 // It does leave a version in std.
102# define ISNAN(x) (std::isnan(x))
103# elif (defined(__sun) || defined(__sun__)) && defined(__SUNPRO_CC)
104# include <math.h>
105# define ISNAN(x) (::isnan(x))
106# endif
107#endif
108
109#ifndef FINITE
110#error "Can not compile without finite or isfinite function or macro"
111#endif
112
113#ifndef ISNAN
114#error "Can not compile without isnan function or macro"
115#endif
116
117#endif