clibs
Tiny but handy utility libraries for C
Loading...
Searching...
No Matches
integer.h
1/*
2 * @file integer.h
3 * @brief Fixed-width integer types for C (portable across platforms).
4 * @author ByteBard
5 * @copyright MIT
6 *
7 * This header provides fixed-width integer types (e.g., int32_t, uint64_t)
8 * for C89, C99, and MSVC environments.
9 *
10 * For pre-C99 compilers, run get_sizeof_data_type.c first to generate
11 * _sizeof_data_type.h with platform-specific size definitions.
12 *
13 * Design goals:
14 * - Prefer the native implementation when <stdint.h> is available.
15 * - Provide a practical C89/MSVC fallback for exact-width integer types.
16 * - Define min/max macros for the integer types that are actually available.
17 * - Define intmax_t / uintmax_t.
18 * - Define intptr_t / uintptr_t only when a suitable integer type exists.
19 * - Define SIZE_MAX if it is missing.
20 *
21 * Notes:
22 * - Exact-width types are only defined if the implementation actually
23 * provides a matching width.
24 * - On unusual architectures, some exact-width types may be unavailable.
25 */
26
27#ifndef INTEGER_H
28#define INTEGER_H
29
30#include <limits.h>
31#include <stddef.h>
32
33/* ------------------------------------------------------------------------- */
34/* Native C99+ path */
35/* ------------------------------------------------------------------------- */
36
37#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
38
39 #include <stdint.h>
40
41 #ifdef INT8_MAX
42 #define INT8_IS_DEFINED
43 #define UINT8_IS_DEFINED
44 #endif
45
46 #ifdef INT16_MAX
47 #define INT16_IS_DEFINED
48 #define UINT16_IS_DEFINED
49 #endif
50
51 #ifdef INT32_MAX
52 #define INT32_IS_DEFINED
53 #define UINT32_IS_DEFINED
54 #endif
55
56 #ifdef INT64_MAX
57 #define INT64_IS_DEFINED
58 #define UINT64_IS_DEFINED
59 #endif
60
61 #ifndef SIZE_MAX
62 #define SIZE_MAX ((size_t)-1)
63 #endif
64
65/* ------------------------------------------------------------------------- */
66/* Microsoft Visual C++ path */
67/* ------------------------------------------------------------------------- */
68
69#elif defined(_MSC_VER)
70
71 typedef signed char int8_t;
72 typedef unsigned char uint8_t;
73 typedef signed short int16_t;
74 typedef unsigned short uint16_t;
75 typedef signed int int32_t;
76 typedef unsigned int uint32_t;
77 typedef signed __int64 int64_t;
78 typedef unsigned __int64 uint64_t;
79
80 #define INT8_IS_DEFINED
81 #define UINT8_IS_DEFINED
82 #define INT16_IS_DEFINED
83 #define UINT16_IS_DEFINED
84 #define INT32_IS_DEFINED
85 #define UINT32_IS_DEFINED
86 #define INT64_IS_DEFINED
87 #define UINT64_IS_DEFINED
88
89 #ifndef INT8_MIN
90 #define INT8_MIN SCHAR_MIN
91 #endif
92 #ifndef INT8_MAX
93 #define INT8_MAX SCHAR_MAX
94 #endif
95 #ifndef UINT8_MAX
96 #define UINT8_MAX UCHAR_MAX
97 #endif
98
99 #ifndef INT16_MIN
100 #define INT16_MIN SHRT_MIN
101 #endif
102 #ifndef INT16_MAX
103 #define INT16_MAX SHRT_MAX
104 #endif
105 #ifndef UINT16_MAX
106 #define UINT16_MAX USHRT_MAX
107 #endif
108
109 #ifndef INT32_MIN
110 #define INT32_MIN INT_MIN
111 #endif
112 #ifndef INT32_MAX
113 #define INT32_MAX INT_MAX
114 #endif
115 #ifndef UINT32_MAX
116 #define UINT32_MAX UINT_MAX
117 #endif
118
119 #ifndef INT64_MIN
120 #define INT64_MIN (-9223372036854775807i64 - 1)
121 #endif
122 #ifndef INT64_MAX
123 #define INT64_MAX 9223372036854775807i64
124 #endif
125 #ifndef UINT64_MAX
126 #define UINT64_MAX 18446744073709551615ui64
127 #endif
128
129 typedef int64_t intmax_t;
130 typedef uint64_t uintmax_t;
131
132 #ifndef INTMAX_MIN
133 #define INTMAX_MIN INT64_MIN
134 #endif
135 #ifndef INTMAX_MAX
136 #define INTMAX_MAX INT64_MAX
137 #endif
138 #ifndef UINTMAX_MAX
139 #define UINTMAX_MAX UINT64_MAX
140 #endif
141
142 #if defined(_WIN64)
143 typedef signed __int64 intptr_t;
144 typedef unsigned __int64 uintptr_t;
145 #ifndef INTPTR_MIN
146 #define INTPTR_MIN INT64_MIN
147 #endif
148 #ifndef INTPTR_MAX
149 #define INTPTR_MAX INT64_MAX
150 #endif
151 #ifndef UINTPTR_MAX
152 #define UINTPTR_MAX UINT64_MAX
153 #endif
154 #else
155 typedef signed int intptr_t;
156 typedef unsigned int uintptr_t;
157 #ifndef INTPTR_MIN
158 #define INTPTR_MIN INT32_MIN
159 #endif
160 #ifndef INTPTR_MAX
161 #define INTPTR_MAX INT32_MAX
162 #endif
163 #ifndef UINTPTR_MAX
164 #define UINTPTR_MAX UINT32_MAX
165 #endif
166 #endif
167
168 #ifndef SIZE_MAX
169 #define SIZE_MAX ((size_t)-1)
170 #endif
171
172/* ------------------------------------------------------------------------- */
173/* Fallback C89 path */
174/* ------------------------------------------------------------------------- */
175
176#else
177
178 #include "_sizeof_data_type.h"
179
180 /* --------------------------------------------------------------------- */
181 /* Exact-width integer typedef discovery */
182 /* --------------------------------------------------------------------- */
183
184 /* Use char */
185 #if _SIZEOF_CHAR == 8
186 typedef signed char int8_t;
187 typedef unsigned char uint8_t;
188 #define INT8_IS_DEFINED
189 #define UINT8_IS_DEFINED
190 #define INTEGER_INT8_BASE_SCHAR
191 #define INTEGER_UINT8_BASE_UCHAR
192 #elif _SIZEOF_CHAR == 16
193 typedef signed char int16_t;
194 typedef unsigned char uint16_t;
195 #define INT16_IS_DEFINED
196 #define UINT16_IS_DEFINED
197 #define INTEGER_INT16_BASE_SCHAR
198 #define INTEGER_UINT16_BASE_UCHAR
199 #elif _SIZEOF_CHAR == 32
200 typedef signed char int32_t;
201 typedef unsigned char uint32_t;
202 #define INT32_IS_DEFINED
203 #define UINT32_IS_DEFINED
204 #define INTEGER_INT32_BASE_SCHAR
205 #define INTEGER_UINT32_BASE_UCHAR
206 #elif _SIZEOF_CHAR == 64
207 typedef signed char int64_t;
208 typedef unsigned char uint64_t;
209 #define INT64_IS_DEFINED
210 #define UINT64_IS_DEFINED
211 #define INTEGER_INT64_BASE_SCHAR
212 #define INTEGER_UINT64_BASE_UCHAR
213 #endif
214
215 /* Use short */
216 #if _SIZEOF_SHORT == 8
217 #ifndef INT8_IS_DEFINED
218 typedef signed short int8_t;
219 typedef unsigned short uint8_t;
220 #define INT8_IS_DEFINED
221 #define UINT8_IS_DEFINED
222 #define INTEGER_INT8_BASE_SHORT
223 #define INTEGER_UINT8_BASE_USHORT
224 #endif
225 #elif _SIZEOF_SHORT == 16
226 #ifndef INT16_IS_DEFINED
227 typedef signed short int16_t;
228 typedef unsigned short uint16_t;
229 #define INT16_IS_DEFINED
230 #define UINT16_IS_DEFINED
231 #define INTEGER_INT16_BASE_SHORT
232 #define INTEGER_UINT16_BASE_USHORT
233 #endif
234 #elif _SIZEOF_SHORT == 32
235 #ifndef INT32_IS_DEFINED
236 typedef signed short int32_t;
237 typedef unsigned short uint32_t;
238 #define INT32_IS_DEFINED
239 #define UINT32_IS_DEFINED
240 #define INTEGER_INT32_BASE_SHORT
241 #define INTEGER_UINT32_BASE_USHORT
242 #endif
243 #elif _SIZEOF_SHORT == 64
244 #ifndef INT64_IS_DEFINED
245 typedef signed short int64_t;
246 typedef unsigned short uint64_t;
247 #define INT64_IS_DEFINED
248 #define UINT64_IS_DEFINED
249 #define INTEGER_INT64_BASE_SHORT
250 #define INTEGER_UINT64_BASE_USHORT
251 #endif
252 #endif
253
254 /* Use int */
255 #if _SIZEOF_INT == 8
256 #ifndef INT8_IS_DEFINED
257 typedef signed int int8_t;
258 typedef unsigned int uint8_t;
259 #define INT8_IS_DEFINED
260 #define UINT8_IS_DEFINED
261 #define INTEGER_INT8_BASE_INT
262 #define INTEGER_UINT8_BASE_UINT
263 #endif
264 #elif _SIZEOF_INT == 16
265 #ifndef INT16_IS_DEFINED
266 typedef signed int int16_t;
267 typedef unsigned int uint16_t;
268 #define INT16_IS_DEFINED
269 #define UINT16_IS_DEFINED
270 #define INTEGER_INT16_BASE_INT
271 #define INTEGER_UINT16_BASE_UINT
272 #endif
273 #elif _SIZEOF_INT == 32
274 #ifndef INT32_IS_DEFINED
275 typedef signed int int32_t;
276 typedef unsigned int uint32_t;
277 #define INT32_IS_DEFINED
278 #define UINT32_IS_DEFINED
279 #define INTEGER_INT32_BASE_INT
280 #define INTEGER_UINT32_BASE_UINT
281 #endif
282 #elif _SIZEOF_INT == 64
283 #ifndef INT64_IS_DEFINED
284 typedef signed int int64_t;
285 typedef unsigned int uint64_t;
286 #define INT64_IS_DEFINED
287 #define UINT64_IS_DEFINED
288 #define INTEGER_INT64_BASE_INT
289 #define INTEGER_UINT64_BASE_UINT
290 #endif
291 #endif
292
293 /* Use long */
294 #if _SIZEOF_LONG == 8
295 #ifndef INT8_IS_DEFINED
296 typedef signed long int8_t;
297 typedef unsigned long uint8_t;
298 #define INT8_IS_DEFINED
299 #define UINT8_IS_DEFINED
300 #define INTEGER_INT8_BASE_LONG
301 #define INTEGER_UINT8_BASE_ULONG
302 #endif
303 #elif _SIZEOF_LONG == 16
304 #ifndef INT16_IS_DEFINED
305 typedef signed long int16_t;
306 typedef unsigned long uint16_t;
307 #define INT16_IS_DEFINED
308 #define UINT16_IS_DEFINED
309 #define INTEGER_INT16_BASE_LONG
310 #define INTEGER_UINT16_BASE_ULONG
311 #endif
312 #elif _SIZEOF_LONG == 32
313 #ifndef INT32_IS_DEFINED
314 typedef signed long int32_t;
315 typedef unsigned long uint32_t;
316 #define INT32_IS_DEFINED
317 #define UINT32_IS_DEFINED
318 #define INTEGER_INT32_BASE_LONG
319 #define INTEGER_UINT32_BASE_ULONG
320 #endif
321 #elif _SIZEOF_LONG == 64
322 #ifndef INT64_IS_DEFINED
323 typedef signed long int64_t;
324 typedef unsigned long uint64_t;
325 #define INT64_IS_DEFINED
326 #define UINT64_IS_DEFINED
327 #define INTEGER_INT64_BASE_LONG
328 #define INTEGER_UINT64_BASE_ULONG
329 #endif
330 #endif
331
332 /* Use long long if supported */
333 #if defined(__GNUC__) || defined(__clang__)
334 #ifdef _SIZEOF_LONG_LONG
335 #if _SIZEOF_LONG_LONG == 8
336 #ifndef INT8_IS_DEFINED
337 typedef signed long long int8_t;
338 typedef unsigned long long uint8_t;
339 #define INT8_IS_DEFINED
340 #define UINT8_IS_DEFINED
341 #define INTEGER_INT8_BASE_LLONG
342 #define INTEGER_UINT8_BASE_ULLONG
343 #endif
344 #elif _SIZEOF_LONG_LONG == 16
345 #ifndef INT16_IS_DEFINED
346 typedef signed long long int16_t;
347 typedef unsigned long long uint16_t;
348 #define INT16_IS_DEFINED
349 #define UINT16_IS_DEFINED
350 #define INTEGER_INT16_BASE_LLONG
351 #define INTEGER_UINT16_BASE_ULLONG
352 #endif
353 #elif _SIZEOF_LONG_LONG == 32
354 #ifndef INT32_IS_DEFINED
355 typedef signed long long int32_t;
356 typedef unsigned long long uint32_t;
357 #define INT32_IS_DEFINED
358 #define UINT32_IS_DEFINED
359 #define INTEGER_INT32_BASE_LLONG
360 #define INTEGER_UINT32_BASE_ULLONG
361 #endif
362 #elif _SIZEOF_LONG_LONG == 64
363 #ifndef INT64_IS_DEFINED
364 typedef signed long long int64_t;
365 typedef unsigned long long uint64_t;
366 #define INT64_IS_DEFINED
367 #define UINT64_IS_DEFINED
368 #define INTEGER_INT64_BASE_LLONG
369 #define INTEGER_UINT64_BASE_ULLONG
370 #endif
371 #endif
372 #endif
373 #endif
374
375 /* --------------------------------------------------------------------- */
376 /* Exact-width limits */
377 /* --------------------------------------------------------------------- */
378
379 #ifdef INT8_IS_DEFINED
380 #ifndef INT8_MIN
381 #if defined(INTEGER_INT8_BASE_SCHAR)
382 #define INT8_MIN SCHAR_MIN
383 #define INT8_MAX SCHAR_MAX
384 #elif defined(INTEGER_INT8_BASE_SHORT)
385 #define INT8_MIN SHRT_MIN
386 #define INT8_MAX SHRT_MAX
387 #elif defined(INTEGER_INT8_BASE_INT)
388 #define INT8_MIN INT_MIN
389 #define INT8_MAX INT_MAX
390 #elif defined(INTEGER_INT8_BASE_LONG)
391 #define INT8_MIN LONG_MIN
392 #define INT8_MAX LONG_MAX
393 #elif defined(INTEGER_INT8_BASE_LLONG)
394 #define INT8_MIN (-127LL - 1LL)
395 #define INT8_MAX 127LL
396 #endif
397 #endif
398 #endif
399
400 #ifdef UINT8_IS_DEFINED
401 #ifndef UINT8_MAX
402 #if defined(INTEGER_UINT8_BASE_UCHAR)
403 #define UINT8_MAX UCHAR_MAX
404 #elif defined(INTEGER_UINT8_BASE_USHORT)
405 #define UINT8_MAX USHRT_MAX
406 #elif defined(INTEGER_UINT8_BASE_UINT)
407 #define UINT8_MAX UINT_MAX
408 #elif defined(INTEGER_UINT8_BASE_ULONG)
409 #define UINT8_MAX ULONG_MAX
410 #elif defined(INTEGER_UINT8_BASE_ULLONG)
411 #define UINT8_MAX 255ULL
412 #endif
413 #endif
414 #endif
415
416 #ifdef INT16_IS_DEFINED
417 #ifndef INT16_MIN
418 #if defined(INTEGER_INT16_BASE_SCHAR)
419 #define INT16_MIN SCHAR_MIN
420 #define INT16_MAX SCHAR_MAX
421 #elif defined(INTEGER_INT16_BASE_SHORT)
422 #define INT16_MIN SHRT_MIN
423 #define INT16_MAX SHRT_MAX
424 #elif defined(INTEGER_INT16_BASE_INT)
425 #define INT16_MIN INT_MIN
426 #define INT16_MAX INT_MAX
427 #elif defined(INTEGER_INT16_BASE_LONG)
428 #define INT16_MIN LONG_MIN
429 #define INT16_MAX LONG_MAX
430 #elif defined(INTEGER_INT16_BASE_LLONG)
431 #define INT16_MIN (-32767LL - 1LL)
432 #define INT16_MAX 32767LL
433 #endif
434 #endif
435 #endif
436
437 #ifdef UINT16_IS_DEFINED
438 #ifndef UINT16_MAX
439 #if defined(INTEGER_UINT16_BASE_UCHAR)
440 #define UINT16_MAX UCHAR_MAX
441 #elif defined(INTEGER_UINT16_BASE_USHORT)
442 #define UINT16_MAX USHRT_MAX
443 #elif defined(INTEGER_UINT16_BASE_UINT)
444 #define UINT16_MAX UINT_MAX
445 #elif defined(INTEGER_UINT16_BASE_ULONG)
446 #define UINT16_MAX ULONG_MAX
447 #elif defined(INTEGER_UINT16_BASE_ULLONG)
448 #define UINT16_MAX 65535ULL
449 #endif
450 #endif
451 #endif
452
453 #ifdef INT32_IS_DEFINED
454 #ifndef INT32_MIN
455 #if defined(INTEGER_INT32_BASE_SCHAR)
456 #define INT32_MIN SCHAR_MIN
457 #define INT32_MAX SCHAR_MAX
458 #elif defined(INTEGER_INT32_BASE_SHORT)
459 #define INT32_MIN SHRT_MIN
460 #define INT32_MAX SHRT_MAX
461 #elif defined(INTEGER_INT32_BASE_INT)
462 #define INT32_MIN INT_MIN
463 #define INT32_MAX INT_MAX
464 #elif defined(INTEGER_INT32_BASE_LONG)
465 #define INT32_MIN LONG_MIN
466 #define INT32_MAX LONG_MAX
467 #elif defined(INTEGER_INT32_BASE_LLONG)
468 #define INT32_MIN (-2147483647LL - 1LL)
469 #define INT32_MAX 2147483647LL
470 #endif
471 #endif
472 #endif
473
474 #ifdef UINT32_IS_DEFINED
475 #ifndef UINT32_MAX
476 #if defined(INTEGER_UINT32_BASE_UCHAR)
477 #define UINT32_MAX UCHAR_MAX
478 #elif defined(INTEGER_UINT32_BASE_USHORT)
479 #define UINT32_MAX USHRT_MAX
480 #elif defined(INTEGER_UINT32_BASE_UINT)
481 #define UINT32_MAX UINT_MAX
482 #elif defined(INTEGER_UINT32_BASE_ULONG)
483 #define UINT32_MAX ULONG_MAX
484 #elif defined(INTEGER_UINT32_BASE_ULLONG)
485 #define UINT32_MAX 4294967295ULL
486 #endif
487 #endif
488 #endif
489
490 #ifdef INT64_IS_DEFINED
491 #ifndef INT64_MIN
492 #if defined(INTEGER_INT64_BASE_SCHAR)
493 #define INT64_MIN SCHAR_MIN
494 #define INT64_MAX SCHAR_MAX
495 #elif defined(INTEGER_INT64_BASE_SHORT)
496 #define INT64_MIN SHRT_MIN
497 #define INT64_MAX SHRT_MAX
498 #elif defined(INTEGER_INT64_BASE_INT)
499 #define INT64_MIN INT_MIN
500 #define INT64_MAX INT_MAX
501 #elif defined(INTEGER_INT64_BASE_LONG)
502 #define INT64_MIN LONG_MIN
503 #define INT64_MAX LONG_MAX
504 #elif defined(INTEGER_INT64_BASE_LLONG)
505 #define INT64_MIN (-9223372036854775807LL - 1LL)
506 #define INT64_MAX 9223372036854775807LL
507 #endif
508 #endif
509 #endif
510
511 #ifdef UINT64_IS_DEFINED
512 #ifndef UINT64_MAX
513 #if defined(INTEGER_UINT64_BASE_UCHAR)
514 #define UINT64_MAX UCHAR_MAX
515 #elif defined(INTEGER_UINT64_BASE_USHORT)
516 #define UINT64_MAX USHRT_MAX
517 #elif defined(INTEGER_UINT64_BASE_UINT)
518 #define UINT64_MAX UINT_MAX
519 #elif defined(INTEGER_UINT64_BASE_ULONG)
520 #define UINT64_MAX ULONG_MAX
521 #elif defined(INTEGER_UINT64_BASE_ULLONG)
522 #define UINT64_MAX 18446744073709551615ULL
523 #endif
524 #endif
525 #endif
526
527 /* --------------------------------------------------------------------- */
528 /* intmax_t / uintmax_t */
529 /* --------------------------------------------------------------------- */
530
531 #ifdef INT64_IS_DEFINED
532 typedef int64_t intmax_t;
533 typedef uint64_t uintmax_t;
534 #ifndef INTMAX_MIN
535 #define INTMAX_MIN INT64_MIN
536 #endif
537 #ifndef INTMAX_MAX
538 #define INTMAX_MAX INT64_MAX
539 #endif
540 #ifndef UINTMAX_MAX
541 #define UINTMAX_MAX UINT64_MAX
542 #endif
543 #elif defined(INT32_IS_DEFINED)
544 typedef int32_t intmax_t;
545 typedef uint32_t uintmax_t;
546 #ifndef INTMAX_MIN
547 #define INTMAX_MIN INT32_MIN
548 #endif
549 #ifndef INTMAX_MAX
550 #define INTMAX_MAX INT32_MAX
551 #endif
552 #ifndef UINTMAX_MAX
553 #define UINTMAX_MAX UINT32_MAX
554 #endif
555 #elif defined(INT16_IS_DEFINED)
556 typedef int16_t intmax_t;
557 typedef uint16_t uintmax_t;
558 #ifndef INTMAX_MIN
559 #define INTMAX_MIN INT16_MIN
560 #endif
561 #ifndef INTMAX_MAX
562 #define INTMAX_MAX INT16_MAX
563 #endif
564 #ifndef UINTMAX_MAX
565 #define UINTMAX_MAX UINT16_MAX
566 #endif
567 #elif defined(INT8_IS_DEFINED)
568 typedef int8_t intmax_t;
569 typedef uint8_t uintmax_t;
570 #ifndef INTMAX_MIN
571 #define INTMAX_MIN INT8_MIN
572 #endif
573 #ifndef INTMAX_MAX
574 #define INTMAX_MAX INT8_MAX
575 #endif
576 #ifndef UINTMAX_MAX
577 #define UINTMAX_MAX UINT8_MAX
578 #endif
579 #endif
580
581 /* --------------------------------------------------------------------- */
582 /* intptr_t / uintptr_t */
583 /* --------------------------------------------------------------------- */
584
585 #if _SIZEOF_VOID_P == 8
586 #ifdef INT8_IS_DEFINED
587 typedef int8_t intptr_t;
588 typedef uint8_t uintptr_t;
589 #ifndef INTPTR_MIN
590 #define INTPTR_MIN INT8_MIN
591 #endif
592 #ifndef INTPTR_MAX
593 #define INTPTR_MAX INT8_MAX
594 #endif
595 #ifndef UINTPTR_MAX
596 #define UINTPTR_MAX UINT8_MAX
597 #endif
598 #endif
599 #elif _SIZEOF_VOID_P == 16
600 #ifdef INT16_IS_DEFINED
601 typedef int16_t intptr_t;
602 typedef uint16_t uintptr_t;
603 #ifndef INTPTR_MIN
604 #define INTPTR_MIN INT16_MIN
605 #endif
606 #ifndef INTPTR_MAX
607 #define INTPTR_MAX INT16_MAX
608 #endif
609 #ifndef UINTPTR_MAX
610 #define UINTPTR_MAX UINT16_MAX
611 #endif
612 #endif
613 #elif _SIZEOF_VOID_P == 32
614 #ifdef INT32_IS_DEFINED
615 typedef int32_t intptr_t;
616 typedef uint32_t uintptr_t;
617 #ifndef INTPTR_MIN
618 #define INTPTR_MIN INT32_MIN
619 #endif
620 #ifndef INTPTR_MAX
621 #define INTPTR_MAX INT32_MAX
622 #endif
623 #ifndef UINTPTR_MAX
624 #define UINTPTR_MAX UINT32_MAX
625 #endif
626 #endif
627 #elif _SIZEOF_VOID_P == 64
628 #ifdef INT64_IS_DEFINED
629 typedef int64_t intptr_t;
630 typedef uint64_t uintptr_t;
631 #ifndef INTPTR_MIN
632 #define INTPTR_MIN INT64_MIN
633 #endif
634 #ifndef INTPTR_MAX
635 #define INTPTR_MAX INT64_MAX
636 #endif
637 #ifndef UINTPTR_MAX
638 #define UINTPTR_MAX UINT64_MAX
639 #endif
640 #endif
641 #endif
642
643 /* --------------------------------------------------------------------- */
644 /* size_t-related */
645 /* --------------------------------------------------------------------- */
646
647 #ifndef SIZE_MAX
648 #define SIZE_MAX ((size_t)-1)
649 #endif
650
651#endif /* platform selection */
652
653#endif /* INTEGER_H */