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
00019
00020
00021
00022
00023 #ifdef HAVE_IEEEFP_H
00024 extern "C"
00025 {
00026 #include <ieeefp.h>
00027 }
00028 #endif
00029
00030 #ifdef HAVE_INT64_T_64
00031 extern "C"
00032 {
00033 #include <inttypes.h>
00034 }
00035 #endif
00036
00037 #if defined(__GNUC__) && defined(_WIN32)
00038
00039
00040
00041
00042
00043 #include <float.h>
00044 #endif
00045
00046 #include <cmath>
00047 #include <limits>
00048
00049
00050
00051
00052 #define DoubleNotANumber std::numeric_limits<double>::quiet_NaN()
00053
00054
00055 #define DoubleInfinity std::numeric_limits<double>::infinity()
00056 #define DoubleNegInfinity -std::numeric_limits<double>::infinity()
00057
00058 #define DoubleMax std::numeric_limits<double>::max()
00059
00060 inline bool
00061 isFinite(double d)
00062 {
00063 #if defined(HAVE_FINITE) && !defined(HAVE_ISFINITE)
00064 return (finite(d));
00065 #else
00066
00067
00068 using namespace std;
00069 return (isfinite(d));
00070 #endif
00071 }
00072 #define FINITE(x) ( isFinite(x) )
00073
00074 #define ISNAN(x) ( isnan(x) )
00075
00076 #ifdef HAVE_INT64_T_64
00077 typedef int64_t int64;
00078 #else
00079 # ifdef HAVE_LONG_LONG_INT_64
00080 typedef long long int int64;
00081 # else
00082 typedef long int int64;
00083 # ifndef HAVE_LONG_INT_64
00084 # define INT64_IS_REALLY32 1
00085 # warning "Could not find 64bit integer definition!"
00086 # endif
00087 # endif
00088 #endif
00089
00090 inline int getMachineByteOrder() {
00091 static int endian_check = 1;
00092 return *((char *)&endian_check);
00093
00094 }
00095
00096 #endif