Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 1 | #ifndef _STDINT_H |
| 2 | #define _STDINT_H |
| 3 | |
| 4 | #define __NEED_int8_t |
| 5 | #define __NEED_int16_t |
| 6 | #define __NEED_int32_t |
| 7 | #define __NEED_int64_t |
| 8 | |
| 9 | #define __NEED_uint8_t |
| 10 | #define __NEED_uint16_t |
| 11 | #define __NEED_uint32_t |
| 12 | #define __NEED_uint64_t |
| 13 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 14 | #define __NEED_int_fast8_t |
| 15 | #define __NEED_int_fast16_t |
| 16 | #define __NEED_int_fast32_t |
| 17 | #define __NEED_int_fast64_t |
| 18 | |
| 19 | #define __NEED_uint_fast8_t |
| 20 | #define __NEED_uint_fast16_t |
| 21 | #define __NEED_uint_fast32_t |
| 22 | #define __NEED_uint_fast64_t |
| 23 | |
| 24 | #define __NEED_intptr_t |
| 25 | #define __NEED_uintptr_t |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 26 | |
| 27 | #include <bits/alltypes.h> |
| 28 | |
Rich Felker | 28bde3b | 2011-04-11 10:38:00 -0400 | [diff] [blame] | 29 | typedef int8_t int_least8_t; |
| 30 | typedef int16_t int_least16_t; |
| 31 | typedef int32_t int_least32_t; |
| 32 | typedef int64_t int_least64_t; |
| 33 | |
| 34 | typedef uint8_t uint_least8_t; |
| 35 | typedef uint16_t uint_least16_t; |
| 36 | typedef uint32_t uint_least32_t; |
| 37 | typedef uint64_t uint_least64_t; |
| 38 | |
Rich Felker | 43b2e9b | 2011-04-11 10:48:52 -0400 | [diff] [blame] | 39 | typedef long long intmax_t; |
| 40 | typedef unsigned long long uintmax_t; |
| 41 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 42 | #if !defined __cplusplus || defined __STDC_LIMIT_MACROS |
| 43 | |
| 44 | #define INT8_MIN (-1-0x7f) |
| 45 | #define INT16_MIN (-1-0x7fff) |
| 46 | #define INT32_MIN (-1-0x7fffffff) |
| 47 | #define INT64_MIN (-1-0x7fffffffffffffffLL) |
| 48 | |
| 49 | #define INT8_MAX (0x7f) |
| 50 | #define INT16_MAX (0x7fff) |
| 51 | #define INT32_MAX (0x7fffffff) |
| 52 | #define INT64_MAX (0x7fffffffffffffffLL) |
| 53 | |
| 54 | #define UINT8_MAX (0xff) |
| 55 | #define UINT16_MAX (0xffff) |
| 56 | #define UINT32_MAX (0xffffffff) |
| 57 | #define UINT64_MAX (0xffffffffffffffffULL) |
| 58 | |
| 59 | #define INT_LEAST8_MIN INT8_MIN |
| 60 | #define INT_LEAST16_MIN INT16_MIN |
| 61 | #define INT_LEAST32_MIN INT32_MIN |
| 62 | #define INT_LEAST64_MIN INT64_MIN |
| 63 | |
| 64 | #define INT_LEAST8_MAX INT8_MAX |
| 65 | #define INT_LEAST16_MAX INT16_MAX |
| 66 | #define INT_LEAST32_MAX INT32_MAX |
| 67 | #define INT_LEAST64_MAX INT64_MAX |
| 68 | |
| 69 | #define UINT_LEAST8_MAX UINT8_MAX |
| 70 | #define UINT_LEAST16_MAX UINT16_MAX |
| 71 | #define UINT_LEAST32_MAX UINT32_MAX |
| 72 | #define UINT_LEAST64_MAX UINT64_MAX |
| 73 | |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 74 | #define INTMAX_MIN INT64_MIN |
| 75 | #define INTMAX_MAX INT64_MAX |
| 76 | #define UINTMAX_MAX UINT64_MAX |
| 77 | |
Rich Felker | 224c7a3 | 2011-09-19 17:39:51 -0400 | [diff] [blame] | 78 | #define WINT_MIN INT32_MIN |
| 79 | #define WINT_MAX INT32_MAX |
| 80 | |
| 81 | #include <bits/wchar.h> |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 82 | #include <bits/stdint.h> |
| 83 | |
| 84 | #endif |
| 85 | |
| 86 | #if !defined __cplusplus || defined __STDC_CONSTANT_MACROS |
| 87 | |
Rich Felker | a591e03 | 2012-02-07 12:08:27 -0500 | [diff] [blame] | 88 | #define INT8_C(c) c |
| 89 | #define INT16_C(c) c |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 90 | #define INT32_C(c) c |
| 91 | #define INT64_C(c) c ## LL |
| 92 | |
Rich Felker | 3d64946 | 2012-06-08 11:11:44 -0400 | [diff] [blame] | 93 | #define UINT8_C(c) c |
| 94 | #define UINT16_C(c) c |
Rich Felker | 0b44a03 | 2011-02-12 00:22:29 -0500 | [diff] [blame] | 95 | #define UINT32_C(c) c ## U |
| 96 | #define UINT64_C(c) c ## ULL |
| 97 | |
| 98 | #define INTMAX_C(c) c ## LL |
| 99 | #define UINTMAX_C(c) c ## ULL |
| 100 | |
| 101 | #endif |
| 102 | |
| 103 | #endif |