Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

stdint.h

Go to the documentation of this file.
00001 /* ISO C9x 7.18 Integer types <stdint.h> 00002 * Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794) 00003 * 00004 * THIS SOFTWARE IS NOT COPYRIGHTED 00005 * 00006 * Contributor: ATMEL Norway AS 00007 * Adapted to IAR C Compiler for Atmel AVR 8-bit RISC MCU. 00008 * 00009 * This source code is offered for use in the public domain. You may 00010 * use, modify or distribute it freely. 00011 * 00012 * This code is distributed in the hope that it will be useful but 00013 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 00014 * DISCLAIMED. This includes but is not limited to warranties of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00016 * 00017 * Date: 2005-12-20 00018 */ 00019 00020 00021 #ifndef _STDINT_H 00022 #define _STDINT_H 00023 #include <stddef.h> 00024 00025 /* 7.18.1.1 Exact-width integer types */ 00026 typedef signed char int8_t; 00027 typedef unsigned char uint8_t; 00028 typedef signed short int16_t; 00029 typedef unsigned short uint16_t; 00030 typedef signed long int32_t; 00031 typedef unsigned long uint32_t; 00032 typedef signed long long int64_t; 00033 typedef unsigned long long uint64_t; 00034 00035 /* 7.18.1.2 Minimum-width integer types */ 00036 typedef signed char int_least8_t; 00037 typedef unsigned char uint_least8_t; 00038 typedef signed short int_least16_t; 00039 typedef unsigned short uint_least16_t; 00040 typedef signed long int_least32_t; 00041 typedef unsigned long uint_least32_t; 00042 typedef signed long long int_least64_t; 00043 typedef unsigned long long uint_least64_t; 00044 00045 /* 7.18.1.3 Fastest minimum-width integer types 00046 * Not actually guaranteed to be fastest for all purposes 00047 * Here we use the exact-width types for 8 and 16-bit ints. 00048 */ 00049 typedef signed char int_fast8_t; 00050 typedef unsigned char uint_fast8_t; 00051 typedef signed short int_fast16_t; 00052 typedef unsigned short uint_fast16_t; 00053 typedef signed long int_fast32_t; 00054 typedef unsigned long uint_fast32_t; 00055 typedef signed long long int_fast64_t; 00056 typedef unsigned long long uint_fast64_t; 00057 00058 /* 7.18.1.4 Integer types capable of holding object pointers */ 00059 // Already defined by IAR, and differs between specific devices. 00060 //typedef signed int intptr_t; 00061 //typedef unsigned uintptr_t; 00062 00063 /* 7.18.1.5 Greatest-width integer types */ 00064 typedef signed long long intmax_t; 00065 typedef unsigned long long uintmax_t; 00066 00067 /* 7.18.2 Limits of specified-width integer types */ 00068 #if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS) 00069 00070 /* 7.18.2.1 Limits of exact-width integer types */ 00071 #define INT8_MIN (-128) 00072 #define INT16_MIN (-32768) 00073 #define INT32_MIN (-2147483647 - 1) 00074 #define INT64_MIN (-9223372036854775807LL - 1) 00075 00076 #define INT8_MAX 127 00077 #define INT16_MAX 32767 00078 #define INT32_MAX 2147483647 00079 #define INT64_MAX 9223372036854775807LL 00080 00081 #define UINT8_MAX 0xff /* 255U */ 00082 #define UINT16_MAX 0xffff /* 65535U */ 00083 #define UINT32_MAX 0xffffffff /* 4294967295U */ 00084 #define UINT64_MAX 0xffffffffffffffffULL /* 18446744073709551615ULL */ 00085 00086 /* 7.18.2.2 Limits of minimum-width integer types */ 00087 #define INT_LEAST8_MIN INT8_MIN 00088 #define INT_LEAST16_MIN INT16_MIN 00089 #define INT_LEAST32_MIN INT32_MIN 00090 #define INT_LEAST64_MIN INT64_MIN 00091 00092 #define INT_LEAST8_MAX INT8_MAX 00093 #define INT_LEAST16_MAX INT16_MAX 00094 #define INT_LEAST32_MAX INT32_MAX 00095 #define INT_LEAST64_MAX INT64_MAX 00096 00097 #define UINT_LEAST8_MAX UINT8_MAX 00098 #define UINT_LEAST16_MAX UINT16_MAX 00099 #define UINT_LEAST32_MAX UINT32_MAX 00100 #define UINT_LEAST64_MAX UINT64_MAX 00101 00102 /* 7.18.2.3 Limits of fastest minimum-width integer types */ 00103 #define INT_FAST8_MIN INT8_MIN 00104 #define INT_FAST16_MIN INT16_MIN 00105 #define INT_FAST32_MIN INT32_MIN 00106 #define INT_FAST64_MIN INT64_MIN 00107 00108 #define INT_FAST8_MAX INT8_MAX 00109 #define INT_FAST16_MAX INT16_MAX 00110 #define INT_FAST32_MAX INT32_MAX 00111 #define INT_FAST64_MAX INT64_MAX 00112 00113 #define UINT_FAST8_MAX UINT8_MAX 00114 #define UINT_FAST16_MAX UINT16_MAX 00115 #define UINT_FAST32_MAX UINT32_MAX 00116 #define UINT_FAST64_MAX UINT64_MAX 00117 00118 /* 7.18.2.4 Limits of integer types capable of holding 00119 object pointers */ 00120 #define INTPTR_MIN INT32_MIN 00121 #define INTPTR_MAX INT32_MAX 00122 #define UINTPTR_MAX UINT32_MAX 00123 00124 /* 7.18.2.5 Limits of greatest-width integer types */ 00125 #define INTMAX_MIN INT64_MIN 00126 #define INTMAX_MAX INT64_MAX 00127 #define UINTMAX_MAX UINT64_MAX 00128 00129 /* 7.18.3 Limits of other integer types */ 00130 #define PTRDIFF_MAX ((ptrdiff_t)-1) 00131 #define PTRDIFF_MIN (-PTRDIFF_MAX) 00132 00133 #define SIZE_MAX ((size_t)-1) 00134 00135 /* --- The following are also defined in IAR's wchar.h file --- 00136 #ifndef WCHAR_MIN 00137 #define WCHAR_MIN 0 00138 #define WCHAR_MAX ((wchar_t)-1) 00139 #endif 00140 */ 00141 00142 #endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */ 00143 00144 00145 /* 7.18.4 Macros for integer constants */ 00146 #if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS) 00147 00148 /* 7.18.4.1 Macros for minimum-width integer constants */ 00149 #define INT8_C(val) ((int8_t) + (val)) 00150 #define UINT8_C(val) ((uint8_t) + (val##U)) 00151 #define INT16_C(val) ((int16_t) + (val)) 00152 #define UINT16_C(val) ((uint16_t) + (val##U)) 00153 00154 #define INT32_C(val) (val##L) 00155 #define UINT32_C(val) (val##UL) 00156 #define INT64_C(val) (val##LL) 00157 #define UINT64_C(val) (val##ULL) 00158 00159 /* 7.18.4.2 Macros for greatest-width integer constants */ 00160 #define INTMAX_C(val) INT64_C(val) 00161 #define UINTMAX_C(val) UINT64_C(val) 00162 00163 #endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */ 00164 00165 #endif 00166

Generated on Thu Feb 16 16:22:40 2006 for AVR221 - PID controller by doxygen 1.3.7