1 /*------------------------------------------------------------------------- 2 stdint.h - ISO C99 7.18 Integer types <stdint.h> 3 4 Copyright (C) 2005, Maarten Brock <sourceforge.brock AT dse.nl> 5 6 This library is free software; you can redistribute it and/or modify it 7 under the terms of the GNU General Public License as published by the 8 Free Software Foundation; either version 2, or (at your option) any 9 later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this library; see the file COPYING. If not, write to the 18 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, 19 MA 02110-1301, USA. 20 21 As a special exception, if you link this library with other files, 22 some of which are compiled with SDCC, to produce an executable, 23 this library does not by itself cause the resulting executable to 24 be covered by the GNU General Public License. This exception does 25 not however invalidate any other reasons why the executable file 26 might be covered by the GNU General Public License. 27 -------------------------------------------------------------------------*/ 28 29 #ifndef _STDINT_H 30 #define _STDINT_H 1 31 32 /* Exact integral types. */ 33 34 /* Signed. */ 35 36 typedef signed char int8_t; 37 typedef short int int16_t; 38 typedef long int int32_t; 39 40 /* Unsigned. */ 41 typedef unsigned char uint8_t; 42 typedef unsigned short int uint16_t; 43 typedef unsigned long int uint32_t; 44 45 46 /* Small types. */ 47 48 /* Signed. */ 49 typedef signed char int_least8_t; 50 typedef short int int_least16_t; 51 typedef long int int_least32_t; 52 53 /* Unsigned. */ 54 typedef unsigned char uint_least8_t; 55 typedef unsigned short int uint_least16_t; 56 typedef unsigned long int uint_least32_t; 57 58 59 /* Fast types. */ 60 61 /* Signed. */ 62 typedef signed char int_fast8_t; 63 typedef int int_fast16_t; 64 typedef long int int_fast32_t; 65 66 /* Unsigned. */ 67 typedef unsigned char uint_fast8_t; 68 typedef unsigned int uint_fast16_t; 69 typedef unsigned long int uint_fast32_t; 70 71 72 /* Types for `void *' pointers. */ 73 typedef long int intptr_t; 74 typedef unsigned long int uintptr_t; 75 76 77 /* Largest integral types. */ 78 typedef long int intmax_t; 79 typedef unsigned long int uintmax_t; 80 81 82 /* Limits of integral types. */ 83 84 /* Minimum of signed integral types. */ 85 # define INT8_MIN (-128) 86 # define INT16_MIN (-32767-1) 87 # define INT32_MIN (-2147483647L-1) 88 /* Maximum of signed integral types. */ 89 # define INT8_MAX (127) 90 # define INT16_MAX (32767) 91 # define INT32_MAX (2147483647L) 92 93 /* Maximum of unsigned integral types. */ 94 # define UINT8_MAX (255) 95 # define UINT16_MAX (65535) 96 # define UINT32_MAX (4294967295UL) 97 98 /* Minimum of signed integral types having a minimum size. */ 99 # define INT_LEAST8_MIN (-128) 100 # define INT_LEAST16_MIN (-32767-1) 101 # define INT_LEAST32_MIN (-2147483647L-1) 102 /* Maximum of signed integral types having a minimum size. */ 103 # define INT_LEAST8_MAX (127) 104 # define INT_LEAST16_MAX (32767) 105 # define INT_LEAST32_MAX (2147483647L) 106 107 /* Maximum of unsigned integral types having a minimum size. */ 108 # define UINT_LEAST8_MAX (255) 109 # define UINT_LEAST16_MAX (65535) 110 # define UINT_LEAST32_MAX (4294967295UL) 111 112 /* Minimum of fast signed integral types having a minimum size. */ 113 # define INT_FAST8_MIN (-128) 114 # define INT_FAST16_MIN (-32767-1) 115 # define INT_FAST32_MIN (-2147483647L-1) 116 117 /* Maximum of fast signed integral types having a minimum size. */ 118 # define INT_FAST8_MAX (127) 119 # define INT_FAST16_MAX (32767) 120 # define INT_FAST32_MAX (2147483647L) 121 122 /* Maximum of fast unsigned integral types having a minimum size. */ 123 # define UINT_FAST8_MAX (255) 124 # define UINT_FAST16_MAX (65535) 125 # define UINT_FAST32_MAX (4294967295UL) 126 127 /* Values to test for integral types holding `void *' pointer. */ 128 # define INTPTR_MIN (-2147483647L-1) 129 # define INTPTR_MAX (2147483647L) 130 # define UINTPTR_MAX (4294967295UL) 131 132 /* Minimum for largest signed integral type. */ 133 # define INTMAX_MIN (-__INT32_C(-2147483647L)-1) 134 /* Maximum for largest signed integral type. */ 135 # define INTMAX_MAX (__INT32_C(2147483647L)) 136 137 /* Maximum for largest unsigned integral type. */ 138 # define UINTMAX_MAX (__UINT32_C(4294967295UL)) 139 140 141 /* Limits of other integer types. */ 142 143 /* Limits of `ptrdiff_t' type. */ 144 # define PTRDIFF_MIN (-2147483647L-1) 145 # define PTRDIFF_MAX (2147483647L) 146 147 /* Limit of `size_t' type. */ 148 # define SIZE_MAX (65535) 149 150 /* Signed. */ 151 # define INT8_C(c) c 152 # define INT16_C(c) c 153 # define INT32_C(c) c ## L 154 155 /* Unsigned. */ 156 # define UINT8_C(c) c ## U 157 # define UINT16_C(c) c ## U 158 # define UINT32_C(c) c ## UL 159 160 /* Maximal type. */ 161 # define INTMAX_C(c) c ## L 162 # define UINTMAX_C(c) c ## UL 163 164 165 #endif /* stdint.h */ 166