00001
00002 #ifndef GEOS_PLATFORM_H
00003 #define GEOS_PLATFORM_H
00004
00005
00006 #define HAVE_INT64_T_64
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #define HAVE_FINITE 1
00019
00020
00021
00022
00023
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
00042
00043
00044
00045
00046 #include <float.h>
00047 #endif
00048
00049 #include <cmath>
00050 #include <limits>
00051
00052
00053
00054
00055 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
00056
00057
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
00070
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
00081
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;
00101 return *((char *)&endian_check);
00102
00103 }
00104
00105 #endif