GEOS  3.3.9
platform.h
00001 /* include/geos/platform.h.  Generated from platform.h.in by configure.  */
00002 #ifndef GEOS_PLATFORM_H
00003 #define GEOS_PLATFORM_H
00004 
00005 /* Set to 1 if you have `int64_t' type */
00006 /* #undef HAVE_INT64_T_64 */
00007 
00008 /* Set to 1 if `long int' is 64 bits */
00009 /* #undef HAVE_LONG_INT_64 */
00010 
00011 /* Set to 1 if `long long int' is 64 bits */
00012 #define HAVE_LONG_LONG_INT_64 1
00013 
00014 /* Set to 1 if you have ieeefp.h */
00015 /* #undef HAVE_IEEEFP_H */
00016 
00017 /* Has finite */
00018 #define HAVE_FINITE 1
00019 
00020 /* Has isfinite */
00021 /* #undef HAVE_ISFINITE */
00022 
00023 /* Has isnan */
00024 #define HAVE_ISNAN 1
00025 
00026 #ifdef HAVE_IEEEFP_H
00027 extern "C"
00028 {
00029 #include <ieeefp.h>
00030 }
00031 #endif
00032 
00033 #ifdef HAVE_INT64_T_64
00034 extern "C"
00035 {
00036 #include <inttypes.h>
00037 }
00038 #endif
00039 
00040 #if defined(__GNUC__) && defined(_WIN32)
00041 /* For MingW the appropriate definitions are included in
00042  math.h and float.h but the definitions in 
00043  math.h are only included if __STRICT_ANSI__
00044  is not defined.  Since GEOS is compiled with -ansi that
00045  means those definitions are not available. */
00046 #include <float.h>
00047 #endif
00048 
00049 #include <limits> // for std::numeric_limits
00050 
00051 
00052 
00053 //Defines NaN for intel platforms
00054 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
00055 
00056 //Don't forget to define infinities
00057 #define DoubleInfinity std::numeric_limits<double>::infinity()
00058 #define DoubleNegInfinity -std::numeric_limits<double>::infinity()
00059 
00060 #define DoubleMax std::numeric_limits<double>::max()
00061 
00062 #ifdef HAVE_INT64_T_64
00063   typedef int64_t int64;
00064 #else
00065 # ifdef HAVE_LONG_LONG_INT_64
00066    typedef long long int int64;
00067 # else
00068    typedef long int int64;
00069 #  ifndef HAVE_LONG_INT_64
00070 #   define INT64_IS_REALLY32 1
00071 #   warning "Could not find 64bit integer definition!"
00072 #  endif
00073 # endif
00074 #endif
00075 
00076 
00077 #if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
00078 # define FINITE(x) (finite(x))
00079 #else
00080 # if defined(_MSC_VER)
00081 #  define FINITE(x) _finite(static_cast<double>(x))    
00082 # else
00083 #  define FINITE(x) (isfinite(x))
00084 # endif
00085 #endif
00086 
00087 #if defined(HAVE_ISNAN)
00088 # define ISNAN(x) (isnan(x))
00089 #else
00090 # if defined(_MSC_VER)
00091 #  define ISNAN(x) _isnan(x)
00092 # elif defined(__MINGW32__)
00093 // sandro furieri: sanitizing MinGW32
00094 #  define ISNAN(x) (std::isnan(x))
00095 # elif defined(__OSX__) || defined(__APPLE__)
00096    // Hack for OS/X <cmath> incorrectly re-defining isnan() into oblivion.
00097    // It does leave a version in std.
00098 #  define ISNAN(x) (std::isnan(x))
00099 # elif defined(__sun) || defined(__sun__)
00100 #  include <math.h>
00101 #  define ISNAN(x) (::isnan(x))
00102 # endif
00103 #endif
00104 
00105 #ifndef FINITE
00106 #error "Can not compile without finite or isfinite function or macro"
00107 #endif
00108 
00109 #ifndef ISNAN
00110 #error "Can not compile without isnan function or macro"
00111 #endif
00112 
00113 #endif