|
13 | 13 | extern "C" { |
14 | 14 | #endif |
15 | 15 |
|
16 | | -#define INT8_MAX 0x7F |
17 | | -#define INT16_MAX 0x7FFF |
18 | | -#define INT32_MAX 0x7FFFFFFF |
19 | | -#define INT64_MAX 0x7FFFFFFFFFFFFFFFLL |
| 16 | +#define INT8_MAX __INT8_MAX__ |
| 17 | +#define INT16_MAX __INT16_MAX__ |
| 18 | +#define INT32_MAX __INT32_MAX__ |
| 19 | +#define INT64_MAX __INT64_MAX__ |
20 | 20 |
|
21 | 21 | #define INT8_MIN (-INT8_MAX - 1) |
22 | 22 | #define INT16_MIN (-INT16_MAX - 1) |
23 | 23 | #define INT32_MIN (-INT32_MAX - 1) |
24 | 24 | #define INT64_MIN (-INT64_MAX - 1LL) |
25 | 25 |
|
26 | | -#define UINT8_MAX 0xFF |
27 | | -#define UINT16_MAX 0xFFFF |
28 | | -#define UINT32_MAX 0xFFFFFFFFU |
29 | | -#define UINT64_MAX 0xFFFFFFFFFFFFFFFFULL |
| 26 | +#define UINT8_MAX __UINT8_MAX__ |
| 27 | +#define UINT16_MAX __UINT16_MAX__ |
| 28 | +#define UINT32_MAX __UINT32_MAX__ |
| 29 | +#define UINT64_MAX __UINT64_MAX__ |
30 | 30 |
|
31 | | -#define INTPTR_MIN INT32_MIN |
32 | | -#define INTPTR_MAX INT32_MAX |
33 | | -#define UINTPTR_MAX UINT32_MAX |
| 31 | +#define INTPTR_MAX __INTPTR_MAX__ |
| 32 | +#define INTPTR_MIN (-INTPTR_MAX - 1) |
| 33 | +#define UINTPTR_MAX __UINTPTR_MAX__ |
34 | 34 |
|
35 | | -#define PTRDIFF_MIN INT32_MIN |
36 | | -#define PTRDIFF_MAX INT32_MAX |
| 35 | +#define PTRDIFF_MAX __PTRDIFF_MAX__ |
| 36 | +#define PTRDIFF_MIN (-PTRDIFF_MAX - 1) |
37 | 37 |
|
38 | | -#define SIZE_MAX UINT32_MAX |
| 38 | +#define SIZE_MAX __SIZE_MAX__ |
39 | 39 |
|
40 | | -typedef signed char int8_t; |
41 | | -typedef signed short int16_t; |
42 | | -typedef signed int int32_t; |
43 | | -typedef signed long long int64_t; |
| 40 | +typedef __INT8_TYPE__ int8_t; |
| 41 | +typedef __INT16_TYPE__ int16_t; |
| 42 | +typedef __INT32_TYPE__ int32_t; |
| 43 | +typedef __INT64_TYPE__ int64_t; |
44 | 44 |
|
45 | | -/* Assume int to be the fastest type for all types except 64bit ones */ |
| 45 | +typedef __INT_FAST8_TYPE__ int_fast8_t; |
| 46 | +typedef __INT_FAST16_TYPE__ int_fast16_t; |
| 47 | +typedef __INT_FAST32_TYPE__ int_fast32_t; |
| 48 | +typedef __INT_FAST64_TYPE__ int_fast64_t; |
46 | 49 |
|
47 | | -typedef signed int int_fast8_t; |
48 | | -typedef signed int int_fast16_t; |
49 | | -typedef signed int int_fast32_t; |
50 | | -typedef signed long long int_fast64_t; |
| 50 | +typedef __INT_LEAST8_TYPE__ int_least8_t; |
| 51 | +typedef __INT_LEAST16_TYPE__ int_least16_t; |
| 52 | +typedef __INT_LEAST32_TYPE__ int_least32_t; |
| 53 | +typedef __INT_LEAST64_TYPE__ int_least64_t; |
51 | 54 |
|
52 | | -typedef signed char int_least8_t; |
53 | | -typedef signed short int_least16_t; |
54 | | -typedef signed int int_least32_t; |
55 | | -typedef signed long long int_least64_t; |
| 55 | +typedef __UINT8_TYPE__ uint8_t; |
| 56 | +typedef __UINT16_TYPE__ uint16_t; |
| 57 | +typedef __UINT32_TYPE__ uint32_t; |
| 58 | +typedef __UINT64_TYPE__ uint64_t; |
56 | 59 |
|
57 | | -typedef unsigned char uint8_t; |
58 | | -typedef unsigned short uint16_t; |
59 | | -typedef unsigned int uint32_t; |
60 | | -typedef unsigned long long uint64_t; |
| 60 | +typedef __UINT_FAST8_TYPE__ uint_fast8_t; |
| 61 | +typedef __UINT_FAST16_TYPE__ uint_fast16_t; |
| 62 | +typedef __UINT_FAST32_TYPE__ uint_fast32_t; |
| 63 | +typedef __UINT_FAST64_TYPE__ uint_fast64_t; |
61 | 64 |
|
62 | | -typedef unsigned int uint_fast8_t; |
63 | | -typedef unsigned int uint_fast16_t; |
64 | | -typedef unsigned int uint_fast32_t; |
65 | | -typedef unsigned long long uint_fast64_t; |
| 65 | +typedef __UINT_LEAST8_TYPE__ uint_least8_t; |
| 66 | +typedef __UINT_LEAST16_TYPE__ uint_least16_t; |
| 67 | +typedef __UINT_LEAST32_TYPE__ uint_least32_t; |
| 68 | +typedef __UINT_LEAST64_TYPE__ uint_least64_t; |
66 | 69 |
|
67 | | -typedef unsigned char uint_least8_t; |
68 | | -typedef unsigned short uint_least16_t; |
69 | | -typedef unsigned int uint_least32_t; |
70 | | -typedef unsigned long long uint_least64_t; |
71 | | - |
72 | | -typedef int intptr_t; |
73 | | -typedef unsigned int uintptr_t; |
| 70 | +typedef __INTPTR_TYPE__ intptr_t; |
| 71 | +typedef __UINTPTR_TYPE__ uintptr_t; |
74 | 72 |
|
75 | 73 | #ifdef __cplusplus |
76 | 74 | } |
|
0 commit comments