$search
00001 00008 /***************************************************************************** 00009 ** Ifdefs 00010 *****************************************************************************/ 00011 00012 #ifndef ECL_CONFIG_UNKNOWN_HPP_ 00013 #define ECL_CONFIG_UNKNOWN_HPP_ 00014 00015 /***************************************************************************** 00016 ** Includes 00017 *****************************************************************************/ 00018 00019 #include <limits> 00020 #include <climits> 00021 00022 /***************************************************************************** 00023 ** Integers 00024 *****************************************************************************/ 00025 00026 /* 00027 * The c99 standard will only define certain macros for c++ 00028 * if explicitly requested. 00029 */ 00030 #define __STDC_LIMIT_MACROS 00031 00032 #if defined(__GNUC__) 00033 /* 00034 * Note that cstdint is not enabled by default by gcc yet (v4.4). It will 00035 * give a compile time error unless you explicitly pass -std=c++0x to gcc. 00036 */ 00037 #if __GXX_EXPERIMENTAL_CXX0X__ > 0 00038 #include <cstdint> 00039 #else 00040 #include <stdint.h> 00041 #endif 00042 #elif (defined(__STDC__) && __STDC__) 00043 #include <stdint.h> 00044 #else 00045 // nothing here yet - look in graveyard/include/portable_integers for some ideas. 00046 #endif 00047 00048 /* 00049 * These are very naive - update these as we come across different platforms. 00050 */ 00051 #if CHAR_MAX == INT8_MAX 00052 #define ECL_SIZE_OF_CHAR 1 00053 #else 00054 #error "ECL_SIZE_OF_CHAR could not be determined (probably faulty ecl logic)." 00055 #endif 00056 #if SHRT_MAX == INT16_MAX 00057 #define ECL_SIZE_OF_SHORT 2 00058 #else 00059 #error "ECL_SIZE_OF_SHORT could not be determined (probably faulty ecl logic)." 00060 #endif 00061 #if INT_MAX == INT32_MAX 00062 #define ECL_SIZE_OF_INT 4 00063 #else 00064 #error "ECL_SIZE_OF_INT could not be determined (probably faulty ecl logic)." 00065 #endif 00066 #if LONG_MAX == INT32_MAX 00067 #define ECL_SIZE_OF_LONG 4 00068 #elif LONG_MAX == INT64_MAX 00069 #define ECL_SIZE_OF_LONG 8 00070 #else 00071 #error "ECL_SIZE_OF_LONG could not be determined (probably faulty ecl logic)." 00072 #endif 00073 00074 #if LONG_LONG_MAX == INT64_MAX 00075 #define ECL_SIZE_OF_LONG_LONG 8 00076 #else 00077 #error "ECL_SIZE_OF_LONG_LONG could not be determined (probably faulty ecl logic)." 00078 #endif 00079 00080 /***************************************************************************** 00081 ** Floats 00082 *****************************************************************************/ 00083 /* 00084 * These may be somewhat naively assumed. I should hand craftfor 00085 * particular platforms in the future if it ever really 00086 * differs. 00087 */ 00088 #ifdef __GNUC__ 00089 #ifdef __SIZEOF_FLOAT__ 00090 #define ECL_SIZE_OF_FLOAT __SIZEOF_FLOAT__ 00091 #else 00092 #define ECL_SIZE_OF_FLOAT 4 00093 #endif 00094 #ifdef __SIZEOF_DOUBLE__ 00095 #define ECL_SIZE_OF_DOUBLE __SIZEOF_DOUBLE__ 00096 #else 00097 #define ECL_SIZE_OF_DOUBLE 8 00098 #endif 00099 #ifdef __SIZEOF_LONG_DOUBLE__ 00100 #define ECL_SIZE_OF_LONG_DOUBLE __SIZEOF_LONG_DOUBLE__ 00101 #else 00102 #define ECL_SIZE_OF_LONG_DOUBLE 16 00103 #endif 00104 #else // Non Gnu platforms 00105 #define ECL_SIZE_OF_FLOAT 4 00106 #define ECL_SIZE_OF_DOUBLE 8 00107 #define ECL_SIZE_OF_LONG_DOUBLE 16 // This is often 12! 00108 #endif 00109 00110 #endif /* ECL_CONFIG_UNKNOWN_HPP_ */