Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:52:25

0001 // ISO C9x  compliant stdint.h for Microsoft Visual Studio
0002 // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 
0003 // 
0004 //  Copyright (c) 2006-2013 Alexander Chemeris
0005 // 
0006 // Redistribution and use in source and binary forms, with or without
0007 // modification, are permitted provided that the following conditions are met:
0008 // 
0009 //   1. Redistributions of source code must retain the above copyright notice,
0010 //      this list of conditions and the following disclaimer.
0011 // 
0012 //   2. Redistributions in binary form must reproduce the above copyright
0013 //      notice, this list of conditions and the following disclaimer in the
0014 //      documentation and/or other materials provided with the distribution.
0015 // 
0016 //   3. Neither the name of the product nor the names of its contributors may
0017 //      be used to endorse or promote products derived from this software
0018 //      without specific prior written permission.
0019 // 
0020 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
0021 // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0022 // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
0023 // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0024 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
0025 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
0026 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
0027 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
0028 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
0029 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0030 // 
0031 ///////////////////////////////////////////////////////////////////////////////
0032 
0033 // The above software in this distribution may have been modified by 
0034 // THL A29 Limited ("Tencent Modifications"). 
0035 // All Tencent Modifications are Copyright (C) 2015 THL A29 Limited.
0036 
0037 #ifndef _MSC_VER // [
0038 #error "Use this header only with Microsoft Visual C++ compilers!"
0039 #endif // _MSC_VER ]
0040 
0041 #ifndef _MSC_STDINT_H_ // [
0042 #define _MSC_STDINT_H_
0043 
0044 #if _MSC_VER > 1000
0045 #pragma once
0046 #endif
0047 
0048 // miloyip: Originally Visual Studio 2010 uses its own stdint.h. However it generates warning with INT64_C(), so change to use this file for vs2010.
0049 #if _MSC_VER >= 1600 // [
0050 #include <stdint.h>
0051 
0052 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
0053 
0054 #undef INT8_C
0055 #undef INT16_C
0056 #undef INT32_C
0057 #undef INT64_C
0058 #undef UINT8_C
0059 #undef UINT16_C
0060 #undef UINT32_C
0061 #undef UINT64_C
0062 
0063 // 7.18.4.1 Macros for minimum-width integer constants
0064 
0065 #define INT8_C(val)  val##i8
0066 #define INT16_C(val) val##i16
0067 #define INT32_C(val) val##i32
0068 #define INT64_C(val) val##i64
0069 
0070 #define UINT8_C(val)  val##ui8
0071 #define UINT16_C(val) val##ui16
0072 #define UINT32_C(val) val##ui32
0073 #define UINT64_C(val) val##ui64
0074 
0075 // 7.18.4.2 Macros for greatest-width integer constants
0076 // These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
0077 // Check out Issue 9 for the details.
0078 #ifndef INTMAX_C //   [
0079 #  define INTMAX_C   INT64_C
0080 #endif // INTMAX_C    ]
0081 #ifndef UINTMAX_C //  [
0082 #  define UINTMAX_C  UINT64_C
0083 #endif // UINTMAX_C   ]
0084 
0085 #endif // __STDC_CONSTANT_MACROS ]
0086 
0087 #else // ] _MSC_VER >= 1700 [
0088 
0089 #include <limits.h>
0090 
0091 // For Visual Studio 6 in C++ mode and for many Visual Studio versions when
0092 // compiling for ARM we have to wrap <wchar.h> include with 'extern "C++" {}'
0093 // or compiler would give many errors like this:
0094 //   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
0095 #if defined(__cplusplus) && !defined(_M_ARM)
0096 extern "C" {
0097 #endif
0098 #  include <wchar.h>
0099 #if defined(__cplusplus) && !defined(_M_ARM)
0100 }
0101 #endif
0102 
0103 // Define _W64 macros to mark types changing their size, like intptr_t.
0104 #ifndef _W64
0105 #  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
0106 #     define _W64 __w64
0107 #  else
0108 #     define _W64
0109 #  endif
0110 #endif
0111 
0112 
0113 // 7.18.1 Integer types
0114 
0115 // 7.18.1.1 Exact-width integer types
0116 
0117 // Visual Studio 6 and Embedded Visual C++ 4 doesn't
0118 // realize that, e.g. char has the same size as __int8
0119 // so we give up on __intX for them.
0120 #if (_MSC_VER < 1300)
0121    typedef signed char       int8_t;
0122    typedef signed short      int16_t;
0123    typedef signed int        int32_t;
0124    typedef unsigned char     uint8_t;
0125    typedef unsigned short    uint16_t;
0126    typedef unsigned int      uint32_t;
0127 #else
0128    typedef signed __int8     int8_t;
0129    typedef signed __int16    int16_t;
0130    typedef signed __int32    int32_t;
0131    typedef unsigned __int8   uint8_t;
0132    typedef unsigned __int16  uint16_t;
0133    typedef unsigned __int32  uint32_t;
0134 #endif
0135 typedef signed __int64       int64_t;
0136 typedef unsigned __int64     uint64_t;
0137 
0138 
0139 // 7.18.1.2 Minimum-width integer types
0140 typedef int8_t    int_least8_t;
0141 typedef int16_t   int_least16_t;
0142 typedef int32_t   int_least32_t;
0143 typedef int64_t   int_least64_t;
0144 typedef uint8_t   uint_least8_t;
0145 typedef uint16_t  uint_least16_t;
0146 typedef uint32_t  uint_least32_t;
0147 typedef uint64_t  uint_least64_t;
0148 
0149 // 7.18.1.3 Fastest minimum-width integer types
0150 typedef int8_t    int_fast8_t;
0151 typedef int16_t   int_fast16_t;
0152 typedef int32_t   int_fast32_t;
0153 typedef int64_t   int_fast64_t;
0154 typedef uint8_t   uint_fast8_t;
0155 typedef uint16_t  uint_fast16_t;
0156 typedef uint32_t  uint_fast32_t;
0157 typedef uint64_t  uint_fast64_t;
0158 
0159 // 7.18.1.4 Integer types capable of holding object pointers
0160 #ifdef _WIN64 // [
0161    typedef signed __int64    intptr_t;
0162    typedef unsigned __int64  uintptr_t;
0163 #else // _WIN64 ][
0164    typedef _W64 signed int   intptr_t;
0165    typedef _W64 unsigned int uintptr_t;
0166 #endif // _WIN64 ]
0167 
0168 // 7.18.1.5 Greatest-width integer types
0169 typedef int64_t   intmax_t;
0170 typedef uint64_t  uintmax_t;
0171 
0172 
0173 // 7.18.2 Limits of specified-width integer types
0174 
0175 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
0176 
0177 // 7.18.2.1 Limits of exact-width integer types
0178 #define INT8_MIN     ((int8_t)_I8_MIN)
0179 #define INT8_MAX     _I8_MAX
0180 #define INT16_MIN    ((int16_t)_I16_MIN)
0181 #define INT16_MAX    _I16_MAX
0182 #define INT32_MIN    ((int32_t)_I32_MIN)
0183 #define INT32_MAX    _I32_MAX
0184 #define INT64_MIN    ((int64_t)_I64_MIN)
0185 #define INT64_MAX    _I64_MAX
0186 #define UINT8_MAX    _UI8_MAX
0187 #define UINT16_MAX   _UI16_MAX
0188 #define UINT32_MAX   _UI32_MAX
0189 #define UINT64_MAX   _UI64_MAX
0190 
0191 // 7.18.2.2 Limits of minimum-width integer types
0192 #define INT_LEAST8_MIN    INT8_MIN
0193 #define INT_LEAST8_MAX    INT8_MAX
0194 #define INT_LEAST16_MIN   INT16_MIN
0195 #define INT_LEAST16_MAX   INT16_MAX
0196 #define INT_LEAST32_MIN   INT32_MIN
0197 #define INT_LEAST32_MAX   INT32_MAX
0198 #define INT_LEAST64_MIN   INT64_MIN
0199 #define INT_LEAST64_MAX   INT64_MAX
0200 #define UINT_LEAST8_MAX   UINT8_MAX
0201 #define UINT_LEAST16_MAX  UINT16_MAX
0202 #define UINT_LEAST32_MAX  UINT32_MAX
0203 #define UINT_LEAST64_MAX  UINT64_MAX
0204 
0205 // 7.18.2.3 Limits of fastest minimum-width integer types
0206 #define INT_FAST8_MIN    INT8_MIN
0207 #define INT_FAST8_MAX    INT8_MAX
0208 #define INT_FAST16_MIN   INT16_MIN
0209 #define INT_FAST16_MAX   INT16_MAX
0210 #define INT_FAST32_MIN   INT32_MIN
0211 #define INT_FAST32_MAX   INT32_MAX
0212 #define INT_FAST64_MIN   INT64_MIN
0213 #define INT_FAST64_MAX   INT64_MAX
0214 #define UINT_FAST8_MAX   UINT8_MAX
0215 #define UINT_FAST16_MAX  UINT16_MAX
0216 #define UINT_FAST32_MAX  UINT32_MAX
0217 #define UINT_FAST64_MAX  UINT64_MAX
0218 
0219 // 7.18.2.4 Limits of integer types capable of holding object pointers
0220 #ifdef _WIN64 // [
0221 #  define INTPTR_MIN   INT64_MIN
0222 #  define INTPTR_MAX   INT64_MAX
0223 #  define UINTPTR_MAX  UINT64_MAX
0224 #else // _WIN64 ][
0225 #  define INTPTR_MIN   INT32_MIN
0226 #  define INTPTR_MAX   INT32_MAX
0227 #  define UINTPTR_MAX  UINT32_MAX
0228 #endif // _WIN64 ]
0229 
0230 // 7.18.2.5 Limits of greatest-width integer types
0231 #define INTMAX_MIN   INT64_MIN
0232 #define INTMAX_MAX   INT64_MAX
0233 #define UINTMAX_MAX  UINT64_MAX
0234 
0235 // 7.18.3 Limits of other integer types
0236 
0237 #ifdef _WIN64 // [
0238 #  define PTRDIFF_MIN  _I64_MIN
0239 #  define PTRDIFF_MAX  _I64_MAX
0240 #else  // _WIN64 ][
0241 #  define PTRDIFF_MIN  _I32_MIN
0242 #  define PTRDIFF_MAX  _I32_MAX
0243 #endif  // _WIN64 ]
0244 
0245 #define SIG_ATOMIC_MIN  INT_MIN
0246 #define SIG_ATOMIC_MAX  INT_MAX
0247 
0248 #ifndef SIZE_MAX // [
0249 #  ifdef _WIN64 // [
0250 #     define SIZE_MAX  _UI64_MAX
0251 #  else // _WIN64 ][
0252 #     define SIZE_MAX  _UI32_MAX
0253 #  endif // _WIN64 ]
0254 #endif // SIZE_MAX ]
0255 
0256 // WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
0257 #ifndef WCHAR_MIN // [
0258 #  define WCHAR_MIN  0
0259 #endif  // WCHAR_MIN ]
0260 #ifndef WCHAR_MAX // [
0261 #  define WCHAR_MAX  _UI16_MAX
0262 #endif  // WCHAR_MAX ]
0263 
0264 #define WINT_MIN  0
0265 #define WINT_MAX  _UI16_MAX
0266 
0267 #endif // __STDC_LIMIT_MACROS ]
0268 
0269 
0270 // 7.18.4 Limits of other integer types
0271 
0272 #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
0273 
0274 // 7.18.4.1 Macros for minimum-width integer constants
0275 
0276 #define INT8_C(val)  val##i8
0277 #define INT16_C(val) val##i16
0278 #define INT32_C(val) val##i32
0279 #define INT64_C(val) val##i64
0280 
0281 #define UINT8_C(val)  val##ui8
0282 #define UINT16_C(val) val##ui16
0283 #define UINT32_C(val) val##ui32
0284 #define UINT64_C(val) val##ui64
0285 
0286 // 7.18.4.2 Macros for greatest-width integer constants
0287 // These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
0288 // Check out Issue 9 for the details.
0289 #ifndef INTMAX_C //   [
0290 #  define INTMAX_C   INT64_C
0291 #endif // INTMAX_C    ]
0292 #ifndef UINTMAX_C //  [
0293 #  define UINTMAX_C  UINT64_C
0294 #endif // UINTMAX_C   ]
0295 
0296 #endif // __STDC_CONSTANT_MACROS ]
0297 
0298 #endif // _MSC_VER >= 1600 ]
0299 
0300 #endif // _MSC_STDINT_H_ ]