Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/stdint.h
1 /* Copyright (C) 1997-2026 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <https://www.gnu.org/licenses/>. */ 17 18 /* 19 * ISO C99: 7.18 Integer types <stdint.h> 20 */ 21 22 #ifndef _STDINT_H 23 #define _STDINT_H 1 24 25 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION 26 #include <bits/libc-header-start.h> 27 #include <bits/types.h> 28 #include <bits/wchar.h> 29 #include <bits/wordsize.h> 30 31 #if __GLIBC_USE (ISOC23) 32 # define __STDC_VERSION_STDINT_H__ 202311L 33 #endif 34 35 /* Exact integral types. */ 36 37 /* Signed. */ 38 #include <bits/stdint-intn.h> 39 40 /* Unsigned. */ 41 #include <bits/stdint-uintn.h> 42 43 44 /* Small types. */ 45 #include <bits/stdint-least.h> 46 47 48 /* Fast types. */ 49 50 /* Signed. */ 51 typedef signed char int_fast8_t; 52 #if __WORDSIZE == 64 53 typedef long int int_fast16_t; 54 typedef long int int_fast32_t; 55 typedef long int int_fast64_t; 56 #else 57 typedef int int_fast16_t; 58 typedef int int_fast32_t; 59 __extension__ 60 typedef long long int int_fast64_t; 61 #endif 62 63 /* Unsigned. */ 64 typedef unsigned char uint_fast8_t; 65 #if __WORDSIZE == 64 66 typedef unsigned long int uint_fast16_t; 67 typedef unsigned long int uint_fast32_t; 68 typedef unsigned long int uint_fast64_t; 69 #else 70 typedef unsigned int uint_fast16_t; 71 typedef unsigned int uint_fast32_t; 72 __extension__ 73 typedef unsigned long long int uint_fast64_t; 74 #endif 75 76 77 /* Types for `void *' pointers. */ 78 #if __WORDSIZE == 64 79 # ifndef __intptr_t_defined 80 typedef long int intptr_t; 81 # define __intptr_t_defined 82 # endif 83 typedef unsigned long int uintptr_t; 84 #else 85 # ifndef __intptr_t_defined 86 typedef int intptr_t; 87 # define __intptr_t_defined 88 # endif 89 typedef unsigned int uintptr_t; 90 #endif 91 92 93 /* Largest integral types. */ 94 typedef __intmax_t intmax_t; 95 typedef __uintmax_t uintmax_t; 96 97 98 # undef __INT64_C 99 # undef __UINT64_C 100 # if __WORDSIZE == 64 101 # define __INT64_C(c) c ## L 102 # define __UINT64_C(c) c ## UL 103 # else 104 # define __INT64_C(c) c ## LL 105 # define __UINT64_C(c) c ## ULL 106 # endif 107 108 /* Limits of integral types. */ 109 110 /* Minimum of signed integral types. */ 111 # define INT8_MIN (-128) 112 # define INT16_MIN (-32767-1) 113 # define INT32_MIN (-2147483647-1) 114 # define INT64_MIN (-__INT64_C(9223372036854775807)-1) 115 /* Maximum of signed integral types. */ 116 # define INT8_MAX (127) 117 # define INT16_MAX (32767) 118 # define INT32_MAX (2147483647) 119 # define INT64_MAX (__INT64_C(9223372036854775807)) 120 121 /* Maximum of unsigned integral types. */ 122 # define UINT8_MAX (255) 123 # define UINT16_MAX (65535) 124 # define UINT32_MAX (4294967295U) 125 # define UINT64_MAX (__UINT64_C(18446744073709551615)) 126 127 128 /* Minimum of signed integral types having a minimum size. */ 129 # define INT_LEAST8_MIN (-128) 130 # define INT_LEAST16_MIN (-32767-1) 131 # define INT_LEAST32_MIN (-2147483647-1) 132 # define INT_LEAST64_MIN (-__INT64_C(9223372036854775807)-1) 133 /* Maximum of signed integral types having a minimum size. */ 134 # define INT_LEAST8_MAX (127) 135 # define INT_LEAST16_MAX (32767) 136 # define INT_LEAST32_MAX (2147483647) 137 # define INT_LEAST64_MAX (__INT64_C(9223372036854775807)) 138 139 /* Maximum of unsigned integral types having a minimum size. */ 140 # define UINT_LEAST8_MAX (255) 141 # define UINT_LEAST16_MAX (65535) 142 # define UINT_LEAST32_MAX (4294967295U) 143 # define UINT_LEAST64_MAX (__UINT64_C(18446744073709551615)) 144 145 146 /* Minimum of fast signed integral types having a minimum size. */ 147 # define INT_FAST8_MIN (-128) 148 # if __WORDSIZE == 64 149 # define INT_FAST16_MIN (-9223372036854775807L-1) 150 # define INT_FAST32_MIN (-9223372036854775807L-1) 151 # else 152 # define INT_FAST16_MIN (-2147483647-1) 153 # define INT_FAST32_MIN (-2147483647-1) 154 # endif 155 # define INT_FAST64_MIN (-__INT64_C(9223372036854775807)-1) 156 /* Maximum of fast signed integral types having a minimum size. */ 157 # define INT_FAST8_MAX (127) 158 # if __WORDSIZE == 64 159 # define INT_FAST16_MAX (9223372036854775807L) 160 # define INT_FAST32_MAX (9223372036854775807L) 161 # else 162 # define INT_FAST16_MAX (2147483647) 163 # define INT_FAST32_MAX (2147483647) 164 # endif 165 # define INT_FAST64_MAX (__INT64_C(9223372036854775807)) 166 167 /* Maximum of fast unsigned integral types having a minimum size. */ 168 # define UINT_FAST8_MAX (255) 169 # if __WORDSIZE == 64 170 # define UINT_FAST16_MAX (18446744073709551615UL) 171 # define UINT_FAST32_MAX (18446744073709551615UL) 172 # else 173 # define UINT_FAST16_MAX (4294967295U) 174 # define UINT_FAST32_MAX (4294967295U) 175 # endif 176 # define UINT_FAST64_MAX (__UINT64_C(18446744073709551615)) 177 178 179 /* Values to test for integral types holding `void *' pointer. */ 180 # if __WORDSIZE == 64 181 # define INTPTR_MIN (-9223372036854775807L-1) 182 # define INTPTR_MAX (9223372036854775807L) 183 # define UINTPTR_MAX (18446744073709551615UL) 184 # else 185 # define INTPTR_MIN (-2147483647-1) 186 # define INTPTR_MAX (2147483647) 187 # define UINTPTR_MAX (4294967295U) 188 # endif 189 190 191 /* Minimum for largest signed integral type. */ 192 # define INTMAX_MIN (-__INT64_C(9223372036854775807)-1) 193 /* Maximum for largest signed integral type. */ 194 # define INTMAX_MAX (__INT64_C(9223372036854775807)) 195 196 /* Maximum for largest unsigned integral type. */ 197 # define UINTMAX_MAX (__UINT64_C(18446744073709551615)) 198 199 200 /* Limits of other integer types. */ 201 202 /* Limits of `ptrdiff_t' type. */ 203 # if __WORDSIZE == 64 204 # define PTRDIFF_MIN (-9223372036854775807L-1) 205 # define PTRDIFF_MAX (9223372036854775807L) 206 # else 207 # if __WORDSIZE32_PTRDIFF_LONG 208 # define PTRDIFF_MIN (-2147483647L-1) 209 # define PTRDIFF_MAX (2147483647L) 210 # else 211 # define PTRDIFF_MIN (-2147483647-1) 212 # define PTRDIFF_MAX (2147483647) 213 # endif 214 # endif 215 216 /* Limits of `sig_atomic_t'. */ 217 # define SIG_ATOMIC_MIN (-2147483647-1) 218 # define SIG_ATOMIC_MAX (2147483647) 219 220 /* Limit of `size_t' type. */ 221 # if __WORDSIZE == 64 222 # define SIZE_MAX (18446744073709551615UL) 223 # else 224 # if __WORDSIZE32_SIZE_ULONG 225 # define SIZE_MAX (4294967295UL) 226 # else 227 # define SIZE_MAX (4294967295U) 228 # endif 229 # endif 230 231 /* Limits of `wchar_t'. */ 232 # ifndef WCHAR_MIN 233 /* These constants might also be defined in <wchar.h>. */ 234 # define WCHAR_MIN __WCHAR_MIN 235 # define WCHAR_MAX __WCHAR_MAX 236 # endif 237 238 /* Limits of `wint_t'. */ 239 # define WINT_MIN (0u) 240 # define WINT_MAX (4294967295u) 241 242 /* Signed. */ 243 # define INT8_C(c) c 244 # define INT16_C(c) c 245 # define INT32_C(c) c 246 # if __WORDSIZE == 64 247 # define INT64_C(c) c ## L 248 # else 249 # define INT64_C(c) c ## LL 250 # endif 251 252 /* Unsigned. */ 253 # define UINT8_C(c) c 254 # define UINT16_C(c) c 255 # define UINT32_C(c) c ## U 256 # if __WORDSIZE == 64 257 # define UINT64_C(c) c ## UL 258 # else 259 # define UINT64_C(c) c ## ULL 260 # endif 261 262 /* Maximal type. */ 263 # if __WORDSIZE == 64 264 # define INTMAX_C(c) c ## L 265 # define UINTMAX_C(c) c ## UL 266 # else 267 # define INTMAX_C(c) c ## LL 268 # define UINTMAX_C(c) c ## ULL 269 # endif 270 271 #if __GLIBC_USE (IEC_60559_BFP_EXT_C23) 272 273 # define INT8_WIDTH 8 274 # define UINT8_WIDTH 8 275 # define INT16_WIDTH 16 276 # define UINT16_WIDTH 16 277 # define INT32_WIDTH 32 278 # define UINT32_WIDTH 32 279 # define INT64_WIDTH 64 280 # define UINT64_WIDTH 64 281 282 # define INT_LEAST8_WIDTH 8 283 # define UINT_LEAST8_WIDTH 8 284 # define INT_LEAST16_WIDTH 16 285 # define UINT_LEAST16_WIDTH 16 286 # define INT_LEAST32_WIDTH 32 287 # define UINT_LEAST32_WIDTH 32 288 # define INT_LEAST64_WIDTH 64 289 # define UINT_LEAST64_WIDTH 64 290 291 # define INT_FAST8_WIDTH 8 292 # define UINT_FAST8_WIDTH 8 293 # define INT_FAST16_WIDTH __WORDSIZE 294 # define UINT_FAST16_WIDTH __WORDSIZE 295 # define INT_FAST32_WIDTH __WORDSIZE 296 # define UINT_FAST32_WIDTH __WORDSIZE 297 # define INT_FAST64_WIDTH 64 298 # define UINT_FAST64_WIDTH 64 299 300 # define INTPTR_WIDTH __WORDSIZE 301 # define UINTPTR_WIDTH __WORDSIZE 302 303 # define INTMAX_WIDTH 64 304 # define UINTMAX_WIDTH 64 305 306 # define PTRDIFF_WIDTH __WORDSIZE 307 # define SIG_ATOMIC_WIDTH 32 308 # define SIZE_WIDTH __WORDSIZE 309 # define WCHAR_WIDTH 32 310 # define WINT_WIDTH 32 311 312 #endif 313 314 #endif /* stdint.h */