msvc_stdint.h
Go to the documentation of this file.
00001 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00002 // This file is part of FZIs ic_workspace.
00003 //
00004 // This program is free software licensed under the LGPL
00005 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00006 // You can find a copy of this license in LICENSE folder in the top
00007 // directory of the source code.
00008 //
00009 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00010 //
00011 // -- END LICENSE BLOCK ------------------------------------------------
00012 
00013 // ISO C9x  compliant stdint.h for Microsoft Visual Studio
00014 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
00015 //
00016 //  Copyright (c) 2006-2008 Alexander Chemeris
00017 //
00018 // Redistribution and use in source and binary forms, with or without
00019 // modification, are permitted provided that the following conditions are met:
00020 //
00021 //   1. Redistributions of source code must retain the above copyright notice,
00022 //      this list of conditions and the following disclaimer.
00023 //
00024 //   2. Redistributions in binary form must reproduce the above copyright
00025 //      notice, this list of conditions and the following disclaimer in the
00026 //      documentation and/or other materials provided with the distribution.
00027 //
00028 //   3. The name of the author may be used to endorse or promote products
00029 //      derived from this software without specific prior written permission.
00030 //
00031 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00032 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00033 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
00034 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00035 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00036 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00037 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00038 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00039 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00040 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00041 //
00043 
00044 #ifndef _MSC_VER // [
00045 #error "Use this header only with Microsoft Visual C++ compilers!"
00046 #endif // _MSC_VER ]
00047 
00048 #ifndef _MSC_STDINT_H_ // [
00049 #define _MSC_STDINT_H_
00050 
00051 #if _MSC_VER > 1000
00052 #pragma once
00053 #endif
00054 
00055 #include <limits.h>
00056 
00057 // For Visual Studio 6 in C++ mode and for many Visual Studio versions when
00058 // compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
00059 // or compiler give many errors like this:
00060 //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
00061 #ifdef __cplusplus
00062 extern "C"
00063 {
00064 #endif
00065 #  include <wchar.h>
00066 #ifdef __cplusplus
00067 }
00068 #endif
00069 
00070 // Define _W64 macros to mark types changing their size, like intptr_t.
00071 #ifndef _W64
00072 #  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
00073 #     define _W64 __w64
00074 #  else
00075 #     define _W64
00076 #  endif
00077 #endif
00078 
00079 
00080 // 7.18.1 Integer types
00081 
00082 // 7.18.1.1 Exact-width integer types
00083 
00084 // Visual Studio 6 and Embedded Visual C++ 4 doesn't
00085 // realize that, e.g. char has the same size as __int8
00086 // so we give up on __intX for them.
00087 #if (_MSC_VER < 1300)
00088    typedef signed char       int8_t;
00089    typedef signed short      int16_t;
00090    typedef signed int        int32_t;
00091    typedef unsigned char     uint8_t;
00092    typedef unsigned short    uint16_t;
00093    typedef unsigned int      uint32_t;
00094 #else
00095    typedef signed __int8     int8_t;
00096    typedef signed __int16    int16_t;
00097    typedef signed __int32    int32_t;
00098    typedef unsigned __int8   uint8_t;
00099    typedef unsigned __int16  uint16_t;
00100    typedef unsigned __int32  uint32_t;
00101 #endif
00102 typedef signed __int64       int64_t;
00103 typedef unsigned __int64     uint64_t;
00104 
00105 #define HAVE_INT8_T
00106 
00107 // 7.18.1.2 Minimum-width integer types
00108 typedef int8_t    int_least8_t;
00109 typedef int16_t   int_least16_t;
00110 typedef int32_t   int_least32_t;
00111 typedef int64_t   int_least64_t;
00112 typedef uint8_t   uint_least8_t;
00113 typedef uint16_t  uint_least16_t;
00114 typedef uint32_t  uint_least32_t;
00115 typedef uint64_t  uint_least64_t;
00116 
00117 // 7.18.1.3 Fastest minimum-width integer types
00118 typedef int8_t    int_fast8_t;
00119 typedef int16_t   int_fast16_t;
00120 typedef int32_t   int_fast32_t;
00121 typedef int64_t   int_fast64_t;
00122 typedef uint8_t   uint_fast8_t;
00123 typedef uint16_t  uint_fast16_t;
00124 typedef uint32_t  uint_fast32_t;
00125 typedef uint64_t  uint_fast64_t;
00126 
00127 // 7.18.1.4 Integer types capable of holding object pointers
00128 #ifdef _WIN64 // [
00129    typedef signed __int64    intptr_t;
00130    typedef unsigned __int64  uintptr_t;
00131 #else // _WIN64 ][
00132    typedef _W64 signed int   intptr_t;
00133    typedef _W64 unsigned int uintptr_t;
00134 #endif // _WIN64 ]
00135 
00136 // 7.18.1.5 Greatest-width integer types
00137 typedef int64_t   intmax_t;
00138 typedef uint64_t  uintmax_t;
00139 
00140 
00141 // 7.18.2 Limits of specified-width integer types
00142 
00143 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
00144 
00145 // 7.18.2.1 Limits of exact-width integer types
00146 #define INT8_MIN     ((int8_t)_I8_MIN)
00147 #define INT8_MAX     _I8_MAX
00148 #define INT16_MIN    ((int16_t)_I16_MIN)
00149 #define INT16_MAX    _I16_MAX
00150 #define INT32_MIN    ((int32_t)_I32_MIN)
00151 #define INT32_MAX    _I32_MAX
00152 #define INT64_MIN    ((int64_t)_I64_MIN)
00153 #define INT64_MAX    _I64_MAX
00154 #define UINT8_MAX    _UI8_MAX
00155 #define UINT16_MAX   _UI16_MAX
00156 #define UINT32_MAX   _UI32_MAX
00157 #define UINT64_MAX   _UI64_MAX
00158 
00159 // 7.18.2.2 Limits of minimum-width integer types
00160 #define INT_LEAST8_MIN    INT8_MIN
00161 #define INT_LEAST8_MAX    INT8_MAX
00162 #define INT_LEAST16_MIN   INT16_MIN
00163 #define INT_LEAST16_MAX   INT16_MAX
00164 #define INT_LEAST32_MIN   INT32_MIN
00165 #define INT_LEAST32_MAX   INT32_MAX
00166 #define INT_LEAST64_MIN   INT64_MIN
00167 #define INT_LEAST64_MAX   INT64_MAX
00168 #define UINT_LEAST8_MAX   UINT8_MAX
00169 #define UINT_LEAST16_MAX  UINT16_MAX
00170 #define UINT_LEAST32_MAX  UINT32_MAX
00171 #define UINT_LEAST64_MAX  UINT64_MAX
00172 
00173 // 7.18.2.3 Limits of fastest minimum-width integer types
00174 #define INT_FAST8_MIN    INT8_MIN
00175 #define INT_FAST8_MAX    INT8_MAX
00176 #define INT_FAST16_MIN   INT16_MIN
00177 #define INT_FAST16_MAX   INT16_MAX
00178 #define INT_FAST32_MIN   INT32_MIN
00179 #define INT_FAST32_MAX   INT32_MAX
00180 #define INT_FAST64_MIN   INT64_MIN
00181 #define INT_FAST64_MAX   INT64_MAX
00182 #define UINT_FAST8_MAX   UINT8_MAX
00183 #define UINT_FAST16_MAX  UINT16_MAX
00184 #define UINT_FAST32_MAX  UINT32_MAX
00185 #define UINT_FAST64_MAX  UINT64_MAX
00186 
00187 // 7.18.2.4 Limits of integer types capable of holding object pointers
00188 #ifdef _WIN64 // [
00189 #  define INTPTR_MIN   INT64_MIN
00190 #  define INTPTR_MAX   INT64_MAX
00191 #  define UINTPTR_MAX  UINT64_MAX
00192 #else // _WIN64 ][
00193 #  define INTPTR_MIN   INT32_MIN
00194 #  define INTPTR_MAX   INT32_MAX
00195 #  define UINTPTR_MAX  UINT32_MAX
00196 #endif // _WIN64 ]
00197 
00198 // 7.18.2.5 Limits of greatest-width integer types
00199 #define INTMAX_MIN   INT64_MIN
00200 #define INTMAX_MAX   INT64_MAX
00201 #define UINTMAX_MAX  UINT64_MAX
00202 
00203 // 7.18.3 Limits of other integer types
00204 
00205 #ifdef _WIN64 // [
00206 #  define PTRDIFF_MIN  _I64_MIN
00207 #  define PTRDIFF_MAX  _I64_MAX
00208 #else  // _WIN64 ][
00209 #  define PTRDIFF_MIN  _I32_MIN
00210 #  define PTRDIFF_MAX  _I32_MAX
00211 #endif  // _WIN64 ]
00212 
00213 #define SIG_ATOMIC_MIN  INT_MIN
00214 #define SIG_ATOMIC_MAX  INT_MAX
00215 
00216 #ifndef SIZE_MAX // [
00217 #  ifdef _WIN64 // [
00218 #     define SIZE_MAX  _UI64_MAX
00219 #  else // _WIN64 ][
00220 #     define SIZE_MAX  _UI32_MAX
00221 #  endif // _WIN64 ]
00222 #endif // SIZE_MAX ]
00223 
00224 // WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
00225 #ifndef WCHAR_MIN // [
00226 #  define WCHAR_MIN  0
00227 #endif  // WCHAR_MIN ]
00228 #ifndef WCHAR_MAX // [
00229 #  define WCHAR_MAX  _UI16_MAX
00230 #endif  // WCHAR_MAX ]
00231 
00232 #define WINT_MIN  0
00233 #define WINT_MAX  _UI16_MAX
00234 
00235 #endif // __STDC_LIMIT_MACROS ]
00236 
00237 
00238 // 7.18.4 Limits of other integer types
00239 
00240 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
00241 
00242 // 7.18.4.1 Macros for minimum-width integer constants
00243 
00244 #define INT8_C(val)  val##i8
00245 #define INT16_C(val) val##i16
00246 #define INT32_C(val) val##i32
00247 #define INT64_C(val) val##i64
00248 
00249 #define UINT8_C(val)  val##ui8
00250 #define UINT16_C(val) val##ui16
00251 #define UINT32_C(val) val##ui32
00252 #define UINT64_C(val) val##ui64
00253 
00254 // 7.18.4.2 Macros for greatest-width integer constants
00255 //#define INTMAX_C   INT64_C
00256 //#define UINTMAX_C  UINT64_C
00257 
00258 #endif // __STDC_CONSTANT_MACROS ]
00259 
00260 
00261 #endif // _MSC_STDINT_H_ ]


fzi_icl_core
Author(s):
autogenerated on Tue Aug 8 2017 02:28:03