|
37 | 37 | #ifdef CONFIG_MINIMAL_LIBC
|
38 | 38 | #ifndef CONFIG_ENFORCE_ZEPHYR_STDINT
|
39 | 39 |
|
40 |
| -#define __INT8_C(x) x |
41 |
| -#define __UINT8_C(x) x ## U |
42 |
| -#define __INT16_C(x) x |
43 |
| -#define __UINT16_C(x) x ## U |
| 40 | +#define __int_c(v, suffix) v ## suffix |
| 41 | +#define int_c(v, suffix) __int_c(v, suffix) |
| 42 | +#define uint_c(v, suffix) __int_c(v ## U, suffix) |
| 43 | + |
| 44 | +#ifdef __INT64_TYPE__ |
| 45 | +#undef __int_least64_c_suffix__ |
| 46 | +#undef __int_least32_c_suffix__ |
| 47 | +#undef __int_least16_c_suffix__ |
| 48 | +#undef __int_least8_c_suffix__ |
| 49 | +#ifdef __INT64_C_SUFFIX__ |
| 50 | +#define __int_least64_c_suffix__ __INT64_C_SUFFIX__ |
| 51 | +#define __int_least32_c_suffix__ __INT64_C_SUFFIX__ |
| 52 | +#define __int_least16_c_suffix__ __INT64_C_SUFFIX__ |
| 53 | +#define __int_least8_c_suffix__ __INT64_C_SUFFIX__ |
| 54 | +#endif /* __INT64_C_SUFFIX__ */ |
| 55 | +#endif /* __INT64_TYPE__ */ |
| 56 | + |
| 57 | +#ifdef __INT_LEAST64_TYPE__ |
| 58 | +#ifdef __int_least64_c_suffix__ |
| 59 | +#define __INT64_C(x) int_c(x, __int_least64_c_suffix__) |
| 60 | +#define __UINT64_C(x) uint_c(x, __int_least64_c_suffix__) |
| 61 | +#else |
| 62 | +#define __INT64_C(x) x |
| 63 | +#define __UINT64_C(x) x ## U |
| 64 | +#endif /* __int_least64_c_suffix__ */ |
| 65 | +#endif /* __INT_LEAST64_TYPE__ */ |
| 66 | + |
| 67 | +#ifdef __INT32_TYPE__ |
| 68 | +#undef __int_least32_c_suffix__ |
| 69 | +#undef __int_least16_c_suffix__ |
| 70 | +#undef __int_least8_c_suffix__ |
| 71 | +#ifdef __INT32_C_SUFFIX__ |
| 72 | +#define __int_least32_c_suffix__ __INT32_C_SUFFIX__ |
| 73 | +#define __int_least16_c_suffix__ __INT32_C_SUFFIX__ |
| 74 | +#define __int_least8_c_suffix__ __INT32_C_SUFFIX__ |
| 75 | +#endif /* __INT32_C_SUFFIX__ */ |
| 76 | +#endif /* __INT32_TYPE__ */ |
| 77 | + |
| 78 | +#ifdef __INT_LEAST32_TYPE__ |
| 79 | +#ifdef __int_least32_c_suffix__ |
| 80 | +#define __INT32_C(x) int_c(x, __int_least32_c_suffix__) |
| 81 | +#define __UINT32_C(x) uint_c(x, __int_least32_c_suffix__) |
| 82 | +#else |
44 | 83 | #define __INT32_C(x) x
|
45 | 84 | #define __UINT32_C(x) x ## U
|
46 |
| -#define __INT64_C(x) x |
47 |
| -#define __UINT64_C(x) x ## ULL |
| 85 | +#endif /* __int_least32_c_suffix__ */ |
| 86 | +#endif /* __INT_LEAST32_TYPE__ */ |
| 87 | + |
| 88 | +#ifdef __INT16_TYPE__ |
| 89 | +#undef __int_least16_c_suffix__ |
| 90 | +#undef __int_least8_c_suffix__ |
| 91 | +#ifdef __INT16_C_SUFFIX__ |
| 92 | +#define __int_least16_c_suffix__ __INT16_C_SUFFIX__ |
| 93 | +#define __int_least8_c_suffix__ __INT16_C_SUFFIX__ |
| 94 | +#endif /* __INT16_C_SUFFIX__ */ |
| 95 | +#endif /* __INT16_TYPE__ */ |
| 96 | + |
| 97 | +#ifdef __INT_LEAST16_TYPE__ |
| 98 | +#ifdef __int_least16_c_suffix__ |
| 99 | +#define __INT16_C(x) int_c(x, __int_least16_c_suffix__) |
| 100 | +#define __UINT16_C(x) uint_c(x, __int_least16_c_suffix__) |
| 101 | +#else |
| 102 | +#define __INT16_C(x) x |
| 103 | +#define __UINT16_C(x) x ## U |
| 104 | +#endif /* __int_least16_c_suffix__ */ |
| 105 | +#endif /* __INT_LEAST16_TYPE__ */ |
| 106 | + |
| 107 | +#ifdef __INT8_TYPE__ |
| 108 | +#undef __int_least8_c_suffix__ |
| 109 | +#ifdef __INT8_C_SUFFIX__ |
| 110 | +#define __int_least8_c_suffix__ __INT8_C_SUFFIX__ |
| 111 | +#endif /* __INT8_C_SUFFIX__ */ |
| 112 | +#endif /* __INT8_TYPE__ */ |
| 113 | + |
| 114 | +#ifdef __INT_LEAST8_TYPE__ |
| 115 | +#ifdef __int_least8_c_suffix__ |
| 116 | +#define __INT8_C(x) int_c(x, __int_least8_c_suffix__) |
| 117 | +#define __UINT8_C(x) uint_c(x, __int_least8_c_suffix__) |
| 118 | +#else |
| 119 | +#define __INT8_C(x) x |
| 120 | +#define __UINT8_C(x) x ## U |
| 121 | +#endif /* __int_least8_c_suffix__ */ |
| 122 | +#endif /* __INT_LEAST8_TYPE__ */ |
48 | 123 |
|
49 | 124 | #endif /* !CONFIG_ENFORCE_ZEPHYR_STDINT */
|
50 | 125 |
|
51 |
| -#define __INTMAX_C(x) x |
52 |
| -#define __UINTMAX_C(x) x ## ULL |
| 126 | +#define __INTMAX_C(x) int_c(x, __INTMAX_C_SUFFIX__) |
| 127 | +#define __UINTMAX_C(x) int_c(x, __UINTMAX_C_SUFFIX__) |
53 | 128 |
|
54 | 129 | #endif /* CONFIG_MINIMAL_LIBC */
|
55 | 130 |
|
|
0 commit comments