stdint.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /* stdint.h */
  2. /*
  3. * Copyright (c) 2014 Wind River Systems, Inc.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0
  6. */
  7. #ifndef ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_
  8. #define ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #define INT8_MAX __INT8_MAX__
  13. #define INT16_MAX __INT16_MAX__
  14. #define INT32_MAX __INT32_MAX__
  15. #define INT64_MAX __INT64_MAX__
  16. #define INTMAX_MAX __INT64_MAX__
  17. #define INT8_MIN (-INT8_MAX - 1)
  18. #define INT16_MIN (-INT16_MAX - 1)
  19. #define INT32_MIN (-INT32_MAX - 1)
  20. #define INT64_MIN (-INT64_MAX - 1LL)
  21. #define UINT8_MAX __UINT8_MAX__
  22. #define UINT16_MAX __UINT16_MAX__
  23. #define UINT32_MAX __UINT32_MAX__
  24. #define UINT64_MAX __UINT64_MAX__
  25. #define UINTMAX_MAX __UINT64_MAX__
  26. #define INTPTR_MAX __INTPTR_MAX__
  27. #define INTPTR_MIN (-INTPTR_MAX - 1)
  28. #define UINTPTR_MAX __UINTPTR_MAX__
  29. #define PTRDIFF_MAX __PTRDIFF_MAX__
  30. #define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
  31. #define SIZE_MAX __SIZE_MAX__
  32. typedef __INT8_TYPE__ int8_t;
  33. typedef __INT16_TYPE__ int16_t;
  34. typedef __INT32_TYPE__ int32_t;
  35. typedef __INT64_TYPE__ int64_t;
  36. typedef __INT64_TYPE__ intmax_t;
  37. typedef __INT_FAST8_TYPE__ int_fast8_t;
  38. typedef __INT_FAST16_TYPE__ int_fast16_t;
  39. typedef __INT_FAST32_TYPE__ int_fast32_t;
  40. typedef __INT_FAST64_TYPE__ int_fast64_t;
  41. typedef __INT_LEAST8_TYPE__ int_least8_t;
  42. typedef __INT_LEAST16_TYPE__ int_least16_t;
  43. typedef __INT_LEAST32_TYPE__ int_least32_t;
  44. typedef __INT_LEAST64_TYPE__ int_least64_t;
  45. typedef __UINT8_TYPE__ uint8_t;
  46. typedef __UINT16_TYPE__ uint16_t;
  47. typedef __UINT32_TYPE__ uint32_t;
  48. typedef __UINT64_TYPE__ uint64_t;
  49. typedef __UINT64_TYPE__ uintmax_t;
  50. typedef __UINT_FAST8_TYPE__ uint_fast8_t;
  51. typedef __UINT_FAST16_TYPE__ uint_fast16_t;
  52. typedef __UINT_FAST32_TYPE__ uint_fast32_t;
  53. typedef __UINT_FAST64_TYPE__ uint_fast64_t;
  54. typedef __UINT_LEAST8_TYPE__ uint_least8_t;
  55. typedef __UINT_LEAST16_TYPE__ uint_least16_t;
  56. typedef __UINT_LEAST32_TYPE__ uint_least32_t;
  57. typedef __UINT_LEAST64_TYPE__ uint_least64_t;
  58. typedef __INTPTR_TYPE__ intptr_t;
  59. typedef __UINTPTR_TYPE__ uintptr_t;
  60. #ifdef __GNUC__
  61. /* These macros must produce constant integer expressions, which can't
  62. * be done in the preprocessor (casts aren't allowed). Defer to the
  63. * GCC internal functions where they're available.
  64. */
  65. #define INT8_C(_v) __INT8_C(_v)
  66. #define INT16_C(_v) __INT16_C(_v)
  67. #define INT32_C(_v) __INT32_C(_v)
  68. #define INT64_C(_v) __INT64_C(_v)
  69. #define INTMAX_C(_v) __INTMAX_C(_v)
  70. #define UINT8_C(_v) __UINT8_C(_v)
  71. #define UINT16_C(_v) __UINT16_C(_v)
  72. #define UINT32_C(_v) __UINT32_C(_v)
  73. #define UINT64_C(_v) __UINT64_C(_v)
  74. #define UINTMAX_C(_v) __UINTMAX_C(_v)
  75. #endif /* __GNUC__ */
  76. #ifdef __CCAC__
  77. #ifndef __INT8_C
  78. #define __INT8_C(x) x
  79. #endif
  80. #ifndef INT8_C
  81. #define INT8_C(x) __INT8_C(x)
  82. #endif
  83. #ifndef __UINT8_C
  84. #define __UINT8_C(x) x ## U
  85. #endif
  86. #ifndef UINT8_C
  87. #define UINT8_C(x) __UINT8_C(x)
  88. #endif
  89. #ifndef __INT16_C
  90. #define __INT16_C(x) x
  91. #endif
  92. #ifndef INT16_C
  93. #define INT16_C(x) __INT16_C(x)
  94. #endif
  95. #ifndef __UINT16_C
  96. #define __UINT16_C(x) x ## U
  97. #endif
  98. #ifndef UINT16_C
  99. #define UINT16_C(x) __UINT16_C(x)
  100. #endif
  101. #ifndef __INT32_C
  102. #define __INT32_C(x) x
  103. #endif
  104. #ifndef INT32_C
  105. #define INT32_C(x) __INT32_C(x)
  106. #endif
  107. #ifndef __UINT32_C
  108. #define __UINT32_C(x) x ## U
  109. #endif
  110. #ifndef UINT32_C
  111. #define UINT32_C(x) __UINT32_C(x)
  112. #endif
  113. #ifndef __INT64_C
  114. #define __INT64_C(x) x
  115. #endif
  116. #ifndef INT64_C
  117. #define INT64_C(x) __INT64_C(x)
  118. #endif
  119. #ifndef __UINT64_C
  120. #define __UINT64_C(x) x ## ULL
  121. #endif
  122. #ifndef UINT64_C
  123. #define UINT64_C(x) __UINT64_C(x)
  124. #endif
  125. #ifndef __INTMAX_C
  126. #define __INTMAX_C(x) x
  127. #endif
  128. #ifndef INTMAX_C
  129. #define INTMAX_C(x) __INTMAX_C(x)
  130. #endif
  131. #ifndef __UINTMAX_C
  132. #define __UINTMAX_C(x) x ## ULL
  133. #endif
  134. #ifndef UINTMAX_C
  135. #define UINTMAX_C(x) __UINTMAX_C(x)
  136. #endif
  137. #endif /* __CCAC__ */
  138. #ifdef __cplusplus
  139. }
  140. #endif
  141. #endif /* ZEPHYR_LIB_LIBC_MINIMAL_INCLUDE_STDINT_H_ */