File: itkIntTypes.h

package info (click to toggle)
insighttoolkit 3.20.1%2Bgit20120521-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 80,652 kB
  • sloc: cpp: 458,133; ansic: 196,223; fortran: 28,000; python: 3,839; tcl: 1,811; sh: 1,184; java: 583; makefile: 430; csh: 220; perl: 193; xml: 20
file content (203 lines) | stat: -rw-r--r-- 6,100 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit
  Module:    itkIntTypes.h
  Language:  C++
  Date:      $Date$
  Version:   $Revision$

  Copyright (c) Insight Software Consortium. All rights reserved.
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even 
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
     PURPOSE.  See the above copyright notices for more information.

=========================================================================*/
#ifndef __itkIntTypes_h
#define __itkIntTypes_h

#include "itkConfigure.h"

#if defined(ITK_HAVE_STDINT_H)
#include <stdint.h>
#define ITK_HAS_INT_64
#else
// the system doesn't have the C or C++ version of stdint so lets use
// itksys's types for fixed widths
#include "itksys/FundamentalType.h"

#ifdef ITK_HAVE_STDDEF_H
#include <stddef.h>
#endif //ITK_HAVE_STDDEF_H

#if defined(itksys_CAN_CONVERT_UI64_TO_DOUBLE) && ( itksys_SIZEOF_LONG == 8 || itksys_USE_LONG_LONG == 8 )
#define ITK_HAS_INT_64
#endif

#endif // ITK_HAVE_CSTDINT


#if !defined(ITK_LEGACY_REMOVE)
#ifdef __cplusplus
extern "C" {
#endif

  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::int8_t instead. */
  typedef char      ITK_INT8;

  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::int32_8 instead. */
  typedef int       ITK_INT32;

#ifndef _WIN32
  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::int64_t instead. */
  typedef long long   ITK_INT64;
#endif

#ifdef _WIN32

  typedef long      ITK_INT64;
#endif

  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::uint8_t instead. */
  typedef unsigned char   ITK_UINT8;

  /** \deprecated This type have been deprecated due to erroneous
   * value, please use itk::uint16_t instead. */
  typedef unsigned short  ITK_UINT16;

  /** \deprecated This type have been deprecated due to erroneous
   * value, please use itk::uint32_t instead. */
  typedef unsigned        ITK_UINT32;

#ifndef _WIN32
  /** \deprecated This type have been deprecated due to erroneous
   * value, please use itk::uint64_t instead. */
  typedef unsigned long long  ITK_UINT64;
#endif

#ifdef _WIN32

  typedef unsigned long ITK_UINT64;
#endif

  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::intptr_t instead. */
  typedef int       ITK_INTPTR;

  /** \deprecated This type have been deprecated due to erroneous
   *  value, please use itk::uintptr_t instead. */
  typedef unsigned  ITK_UINTPTR;

#ifdef __cplusplus
}
#endif
#endif // ITK_LEGACY_REMOVE

namespace itk
{
#if defined(ITK_HAVE_STDINT_H) 

// Note: these types are technically optional in C99 stdint.h file. As
// such a try complile for their existance may be needed.
typedef ::int8_t   int8_t;
typedef ::uint8_t  uint8_t;
typedef ::int16_t  int16_t;
typedef ::uint16_t uint16_t;
typedef ::int32_t  int32_t;
typedef ::uint32_t uint32_t;
typedef ::int64_t  int64_t;
typedef ::uint64_t uint64_t;


// Note: these types are required for the C99 stdint.h file. However,
// not all C++ systems have a fully functional 64-bit integer.
typedef ::int_least8_t   int_least8_t;
typedef ::uint_least8_t  uint_least8_t;
typedef ::int_least16_t  int_least16_t;
typedef ::uint_least16_t uint_least16_t;
typedef ::int_least32_t  int_least32_t;
typedef ::uint_least32_t uint_least32_t;
typedef ::int_least64_t  int_least64_t;
typedef ::uint_least64_t uint_least64_t;


// Note: these types are required for the C99 stdint.h file. However,
// not all C++ systems have a fully functional 64-bit integer.
typedef ::int_fast8_t   int_fast8_t;
typedef ::uint_fast8_t  uint_fast8_t;
typedef ::int_fast16_t  int_fast16_t;
typedef ::uint_fast16_t uint_fast16_t;
typedef ::int_fast32_t  int_fast32_t;
typedef ::uint_fast32_t uint_fast32_t;
typedef ::int_fast64_t  int_fast64_t;
typedef ::uint_fast64_t uint_fast64_t;

typedef ::intmax_t  intmax_t;
typedef ::uintmax_t uintmax_t;

typedef ::intptr_t  intptr_t;
typedef ::uintptr_t uintptr_t;

#else // ITK_HAVE_STDINT_H || ITK_HAVE_CSTDINT

/** Fixed width interger types. */
typedef ::itksysFundamentalType_Int8   int8_t;
typedef ::itksysFundamentalType_UInt8  uint8_t;
typedef ::itksysFundamentalType_Int16  int16_t;
typedef ::itksysFundamentalType_UInt16 uint16_t;
typedef ::itksysFundamentalType_Int32  int32_t;
typedef ::itksysFundamentalType_UInt32 uint32_t;

/** Types which are at least a certain size, these are prefered over
 *  fixed width. */
typedef int8_t   int_least8_t;
typedef uint8_t  uint_least8_t;
typedef int16_t  int_least16_t;
typedef uint16_t uint_least16_t;
typedef int32_t  int_least32_t;
typedef uint32_t uint_least32_t;

/** Types which are at least a certain size but may be greater if
 *  performace benifits, these are prefered over fixed width. */
typedef int8_t   int_fast8_t;
typedef uint8_t  uint_fast8_t;
typedef int16_t  int_fast16_t;
typedef uint16_t uint_fast16_t;
typedef int32_t  int_fast32_t;
typedef uint32_t uint_fast32_t;

#ifndef ITK_HAS_INT_64

typedef int32_t  intmax_t;
typedef uint32_t uintmax_t;

#else // ITK_HAS_INT_64

/** Optional 64-bit sized types. As not all systems have 64-bit
 *  integers, usage of these types must conditional on the
 * preprocessor definition of ITK_HAS_INT_64. */
typedef ::itksysFundamentalType_Int64  int64_t;
typedef ::itksysFundamentalType_UInt64 uint64_t;
typedef int64_t                        int_least64_t;
typedef uint64_t                       uint_least64_t;
typedef int64_t                        int_fast64_t;
typedef uint64_t                       uint_fast64_t;

/** Types which contain the largest represetable integer. */
typedef int64_t  intmax_t;
typedef uint64_t uintmax_t;

#endif // ITK_HAS_INT_64

typedef ::ptrdiff_t intptr_t;
typedef ::size_t    uintptr_t;

#endif // ITK_HAVE_STDINT_H
}

#endif  /* __itkIntTypes_h */