00001 /*========================================================================= 00002 00003 Program: Insight Segmentation & Registration Toolkit 00004 Module: $RCSfile: itkIntTypes.h,v $ 00005 Language: C++ 00006 Date: $Date: 2010-03-30 17:57:39 $ 00007 Version: $Revision: 1.11 $ 00008 00009 Copyright (c) Insight Software Consortium. All rights reserved. 00010 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 #ifndef __itkIntTypes_h 00018 #define __itkIntTypes_h 00019 00020 #include "itkConfigure.h" 00021 00022 #if defined(ITK_HAVE_STDINT_H) 00023 #include <stdint.h> 00024 #define ITK_HAS_INT_64 00025 #else 00026 // the system doesn't have the C or C++ version of stdint so lets use 00027 // itksys's types for fixed widths 00028 #include "itksys/FundamentalType.h" 00029 00030 #ifdef ITK_HAVE_STDDEF_H 00031 #include <stddef.h> 00032 #endif //ITK_HAVE_STDDEF_H 00033 00034 #if defined(itksys_CAN_CONVERT_UI64_TO_DOUBLE) && ( itksys_SIZEOF_LONG == 8 || itksys_USE_LONG_LONG == 8 ) 00035 #define ITK_HAS_INT_64 00036 #endif 00037 00038 #endif // ITK_HAVE_CSTDINT 00039 00040 00041 #if !defined(ITK_LEGACY_REMOVE) 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00048 typedef char ITK_INT8; 00049 00052 typedef int ITK_INT32; 00053 00054 #ifndef _WIN32 00055 00057 typedef long long ITK_INT64; 00058 #endif 00059 00060 #ifdef _WIN32 00061 00062 typedef long ITK_INT64; 00063 #endif 00064 00067 typedef unsigned char ITK_UINT8; 00068 00071 typedef unsigned short ITK_UINT16; 00072 00075 typedef unsigned ITK_UINT32; 00076 00077 #ifndef _WIN32 00078 00080 typedef unsigned long long ITK_UINT64; 00081 #endif 00082 00083 #ifdef _WIN32 00084 00085 typedef unsigned long ITK_UINT64; 00086 #endif 00087 00090 typedef int ITK_INTPTR; 00091 00094 typedef unsigned ITK_UINTPTR; 00095 00096 #ifdef __cplusplus 00097 } 00098 #endif 00099 #endif // ITK_LEGACY_REMOVE 00100 00101 namespace itk 00102 { 00103 #if defined(ITK_HAVE_STDINT_H) 00104 00105 // Note: these types are technically optional in C99 stdint.h file. As 00106 // such a try complile for their existance may be needed. 00107 typedef ::int8_t int8_t; 00108 typedef ::uint8_t uint8_t; 00109 typedef ::int16_t int16_t; 00110 typedef ::uint16_t uint16_t; 00111 typedef ::int32_t int32_t; 00112 typedef ::uint32_t uint32_t; 00113 typedef ::int64_t int64_t; 00114 typedef ::uint64_t uint64_t; 00115 00116 00117 // Note: these types are required for the C99 stdint.h file. However, 00118 // not all C++ systems have a fully functional 64-bit integer. 00119 typedef ::int_least8_t int_least8_t; 00120 typedef ::uint_least8_t uint_least8_t; 00121 typedef ::int_least16_t int_least16_t; 00122 typedef ::uint_least16_t uint_least16_t; 00123 typedef ::int_least32_t int_least32_t; 00124 typedef ::uint_least32_t uint_least32_t; 00125 typedef ::int_least64_t int_least64_t; 00126 typedef ::uint_least64_t uint_least64_t; 00127 00128 00129 // Note: these types are required for the C99 stdint.h file. However, 00130 // not all C++ systems have a fully functional 64-bit integer. 00131 typedef ::int_fast8_t int_fast8_t; 00132 typedef ::uint_fast8_t uint_fast8_t; 00133 typedef ::int_fast16_t int_fast16_t; 00134 typedef ::uint_fast16_t uint_fast16_t; 00135 typedef ::int_fast32_t int_fast32_t; 00136 typedef ::uint_fast32_t uint_fast32_t; 00137 typedef ::int_fast64_t int_fast64_t; 00138 typedef ::uint_fast64_t uint_fast64_t; 00139 00140 typedef ::intmax_t intmax_t; 00141 typedef ::uintmax_t uintmax_t; 00142 00143 typedef ::intptr_t intptr_t; 00144 typedef ::uintptr_t uintptr_t; 00145 00146 #else // ITK_HAVE_STDINT_H || ITK_HAVE_CSTDINT 00147 00149 typedef ::itksysFundamentalType_Int8 int8_t; 00150 typedef ::itksysFundamentalType_UInt8 uint8_t; 00151 typedef ::itksysFundamentalType_Int16 int16_t; 00152 typedef ::itksysFundamentalType_UInt16 uint16_t; 00153 typedef ::itksysFundamentalType_Int32 int32_t; 00154 typedef ::itksysFundamentalType_UInt32 uint32_t; 00155 00158 typedef int8_t int_least8_t; 00159 typedef uint8_t uint_least8_t; 00160 typedef int16_t int_least16_t; 00161 typedef uint16_t uint_least16_t; 00162 typedef int32_t int_least32_t; 00163 typedef uint32_t uint_least32_t; 00164 00167 typedef int8_t int_fast8_t; 00168 typedef uint8_t uint_fast8_t; 00169 typedef int16_t int_fast16_t; 00170 typedef uint16_t uint_fast16_t; 00171 typedef int32_t int_fast32_t; 00172 typedef uint32_t uint_fast32_t; 00173 00174 #ifndef ITK_HAS_INT_64 00175 00176 typedef int32_t intmax_t; 00177 typedef uint32_t uintmax_t; 00178 00179 #else // ITK_HAS_INT_64 00180 00184 typedef ::itksysFundamentalType_Int64 int64_t; 00185 typedef ::itksysFundamentalType_UInt64 uint64_t; 00186 typedef int64_t int_least64_t; 00187 typedef uint64_t uint_least64_t; 00188 typedef int64_t int_fast64_t; 00189 typedef uint64_t uint_fast64_t; 00190 00192 typedef int64_t intmax_t; 00193 typedef uint64_t uintmax_t; 00194 00195 #endif // ITK_HAS_INT_64 00196 00197 typedef ::ptrdiff_t intptr_t; 00198 typedef ::size_t uintptr_t; 00199 00200 #endif // ITK_HAVE_STDINT_H 00201 } 00202 00203 #endif /* __itkIntTypes_h */ 00204