GEOS 3.2.1
|
00001 /* source/headers/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 #define 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 /* #undef HAVE_LONG_LONG_INT_64 */ 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 <cmath> // for finite()/isfinite() and isnan() 00050 #include <limits> // for std::numeric_limits 00051 00052 00053 00054 //Defines NaN for intel platforms 00055 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN() 00056 00057 //Don't forget to define infinities 00058 #define DoubleInfinity std::numeric_limits<double>::infinity() 00059 #define DoubleNegInfinity -std::numeric_limits<double>::infinity() 00060 00061 #define DoubleMax std::numeric_limits<double>::max() 00062 00063 inline bool 00064 isFinite(double d) 00065 { 00066 #if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE) && !defined(__MINGW32__) 00067 return (finite(d)); 00068 #else 00069 // Put using namespace std; here if you have to 00070 // put it anywhere. 00071 using namespace std; 00072 return (isfinite(d)); 00073 #endif 00074 } 00075 #define FINITE(x) ( isFinite(x) ) 00076 00077 #ifdef HAVE_ISNAN 00078 #define ISNAN(x) ( isnan(x) ) 00079 #else 00080 // Hack for OS/X <cmath> incorrectly re-defining isnan() into 00081 // oblivion. It does leave a version in std. 00082 #define ISNAN(x) ( std::isnan(x) ) 00083 #endif 00084 00085 #ifdef HAVE_INT64_T_64 00086 typedef int64_t int64; 00087 #else 00088 # ifdef HAVE_LONG_LONG_INT_64 00089 typedef long long int int64; 00090 # else 00091 typedef long int int64; 00092 # ifndef HAVE_LONG_INT_64 00093 # define INT64_IS_REALLY32 1 00094 # warning "Could not find 64bit integer definition!" 00095 # endif 00096 # endif 00097 #endif 00098 00099 inline int getMachineByteOrder() { 00100 static int endian_check = 1; // don't modify !! 00101 return *((char *)&endian_check); // 0 == big_endian | xdr, 00102 // 1 == little_endian | ndr 00103 } 00104 00105 #endif