ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

stdint.h
Go to the documentation of this file.
00001 
00006 /* ISO C9x  7.18  Integer types <stdint.h>
00007  * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
00008  *
00009  *  THIS SOFTWARE IS NOT COPYRIGHTED
00010  *
00011  *  Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
00012  *
00013  *  This source code is offered for use in the public domain. You may
00014  *  use, modify or distribute it freely.
00015  *
00016  *  This code is distributed in the hope that it will be useful but
00017  *  WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
00018  *  DISCLAIMED. This includes but is not limited to warranties of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00020  *
00021  *  Date: 2000-12-02
00022  */
00023 
00024 
00025 #ifndef _STDINT_H
00026 #define _STDINT_H
00027 
00028 #include <crtdefs.h>
00029 
00030 #define __need_wint_t
00031 #define __need_wchar_t
00032 #include "stddef.h"
00033 
00034 /* 7.18.1.1  Exact-width integer types */
00035 typedef signed char int8_t;
00036 typedef unsigned char   uint8_t;
00037 typedef short  int16_t;
00038 typedef unsigned short  uint16_t;
00039 typedef int  int32_t;
00040 typedef unsigned   uint32_t;
00041 __MINGW_EXTENSION typedef long long  int64_t;
00042 __MINGW_EXTENSION typedef unsigned long long   uint64_t;
00043 
00044 /* 7.18.1.2  Minimum-width integer types */
00045 typedef signed char int_least8_t;
00046 typedef unsigned char   uint_least8_t;
00047 typedef short  int_least16_t;
00048 typedef unsigned short  uint_least16_t;
00049 typedef int  int_least32_t;
00050 typedef unsigned   uint_least32_t;
00051 __MINGW_EXTENSION typedef long long  int_least64_t;
00052 __MINGW_EXTENSION typedef unsigned long long   uint_least64_t;
00053 
00054 /*  7.18.1.3  Fastest minimum-width integer types
00055  *  Not actually guaranteed to be fastest for all purposes
00056  *  Here we use the exact-width types for 8 and 16-bit ints.
00057  */
00058 typedef char int_fast8_t;
00059 typedef unsigned char uint_fast8_t;
00060 typedef short  int_fast16_t;
00061 typedef unsigned short  uint_fast16_t;
00062 typedef int  int_fast32_t;
00063 typedef unsigned  int  uint_fast32_t;
00064 __MINGW_EXTENSION typedef long long  int_fast64_t;
00065 __MINGW_EXTENSION typedef unsigned long long   uint_fast64_t;
00066 
00067 /* 7.18.1.5  Greatest-width integer types */
00068 __MINGW_EXTENSION typedef long long  intmax_t;
00069 __MINGW_EXTENSION typedef unsigned long long   uintmax_t;
00070 
00071 /* 7.18.2  Limits of specified-width integer types */
00072 #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
00073 
00074 /* 7.18.2.1  Limits of exact-width integer types */
00075 #define INT8_MIN (-128)
00076 #define INT16_MIN (-32768)
00077 #define INT32_MIN (-2147483647 - 1)
00078 #define INT64_MIN  (-9223372036854775807LL - 1)
00079 
00080 #define INT8_MAX 127
00081 #define INT16_MAX 32767
00082 #define INT32_MAX 2147483647
00083 #define INT64_MAX 9223372036854775807LL
00084 
00085 #define UINT8_MAX 0xff /* 255U */
00086 #define UINT16_MAX 0xffff /* 65535U */
00087 #define UINT32_MAX 0xffffffff  /* 4294967295U */
00088 #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */
00089 
00090 /* 7.18.2.2  Limits of minimum-width integer types */
00091 #define INT_LEAST8_MIN INT8_MIN
00092 #define INT_LEAST16_MIN INT16_MIN
00093 #define INT_LEAST32_MIN INT32_MIN
00094 #define INT_LEAST64_MIN INT64_MIN
00095 
00096 #define INT_LEAST8_MAX INT8_MAX
00097 #define INT_LEAST16_MAX INT16_MAX
00098 #define INT_LEAST32_MAX INT32_MAX
00099 #define INT_LEAST64_MAX INT64_MAX
00100 
00101 #define UINT_LEAST8_MAX UINT8_MAX
00102 #define UINT_LEAST16_MAX UINT16_MAX
00103 #define UINT_LEAST32_MAX UINT32_MAX
00104 #define UINT_LEAST64_MAX UINT64_MAX
00105 
00106 /* 7.18.2.3  Limits of fastest minimum-width integer types */
00107 #define INT_FAST8_MIN INT8_MIN
00108 #define INT_FAST16_MIN INT16_MIN
00109 #define INT_FAST32_MIN INT32_MIN
00110 #define INT_FAST64_MIN INT64_MIN
00111 
00112 #define INT_FAST8_MAX INT8_MAX
00113 #define INT_FAST16_MAX INT16_MAX
00114 #define INT_FAST32_MAX INT32_MAX
00115 #define INT_FAST64_MAX INT64_MAX
00116 
00117 #define UINT_FAST8_MAX UINT8_MAX
00118 #define UINT_FAST16_MAX UINT16_MAX
00119 #define UINT_FAST32_MAX UINT32_MAX
00120 #define UINT_FAST64_MAX UINT64_MAX
00121 
00122 /* 7.18.2.4  Limits of integer types capable of holding
00123     object pointers */
00124 #ifdef _WIN64
00125 #define INTPTR_MIN INT64_MIN
00126 #define INTPTR_MAX INT64_MAX
00127 #define UINTPTR_MAX UINT64_MAX
00128 #else
00129 #define INTPTR_MIN INT32_MIN
00130 #define INTPTR_MAX INT32_MAX
00131 #define UINTPTR_MAX UINT32_MAX
00132 #endif
00133 
00134 /* 7.18.2.5  Limits of greatest-width integer types */
00135 #define INTMAX_MIN INT64_MIN
00136 #define INTMAX_MAX INT64_MAX
00137 #define UINTMAX_MAX UINT64_MAX
00138 
00139 /* 7.18.3  Limits of other integer types */
00140 #ifdef _WIN64
00141 #define PTRDIFF_MIN INT64_MIN
00142 #define PTRDIFF_MAX INT64_MAX
00143 #else
00144 #define PTRDIFF_MIN INT32_MIN
00145 #define PTRDIFF_MAX INT32_MAX
00146 #endif
00147 
00148 #define SIG_ATOMIC_MIN INT32_MIN
00149 #define SIG_ATOMIC_MAX INT32_MAX
00150 
00151 #ifndef SIZE_MAX
00152 #ifdef _WIN64
00153 #define SIZE_MAX UINT64_MAX
00154 #else
00155 #define SIZE_MAX UINT32_MAX
00156 #endif
00157 #endif
00158 
00159 #ifndef WCHAR_MIN  /* also in wchar.h */
00160 #define WCHAR_MIN 0
00161 #endif
00162 #ifndef WCHAR_MAX
00163 #define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
00164 #endif
00165 
00166 /*
00167  * wint_t is unsigned short for compatibility with MS runtime
00168  */
00169 #define WINT_MIN 0
00170 #define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
00171 
00172 #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
00173 
00174 
00175 /* 7.18.4  Macros for integer constants */
00176 #if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
00177 
00178 /* 7.18.4.1  Macros for minimum-width integer constants
00179 
00180     Accoding to Douglas Gwyn <gwyn@arl.mil>:
00181     "This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
00182     9899:1999 as initially published, the expansion was required
00183     to be an integer constant of precisely matching type, which
00184     is impossible to accomplish for the shorter types on most
00185     platforms, because C99 provides no standard way to designate
00186     an integer constant with width less than that of type int.
00187     TC1 changed this to require just an integer constant
00188     *expression* with *promoted* type."
00189 
00190     The trick used here is from Clive D W Feather.
00191 */
00192 
00193 #define INT8_C(val) (INT_LEAST8_MAX-INT_LEAST8_MAX+(val))
00194 #define INT16_C(val) (INT_LEAST16_MAX-INT_LEAST16_MAX+(val))
00195 #define INT32_C(val) (INT_LEAST32_MAX-INT_LEAST32_MAX+(val))
00196 /*  The 'trick' doesn't work in C89 for long long because, without
00197     suffix, (val) will be evaluated as int, not intmax_t */
00198 #define INT64_C(val) val##LL
00199 
00200 #define UINT8_C(val) (UINT_LEAST8_MAX-UINT_LEAST8_MAX+(val))
00201 #define UINT16_C(val) (UINT_LEAST16_MAX-UINT_LEAST16_MAX+(val))
00202 #define UINT32_C(val) (UINT_LEAST32_MAX-UINT_LEAST32_MAX+(val))
00203 #define UINT64_C(val) val##ULL
00204 
00205 /* 7.18.4.2  Macros for greatest-width integer constants */
00206 #define INTMAX_C(val) val##LL
00207 #define UINTMAX_C(val) val##ULL
00208 
00209 #endif  /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
00210 
00211 #endif

Generated on Mon May 28 2012 04:29:45 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.