stdint.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. #ifndef _STDINT_H
  2. #define _STDINT_H
  3. #define __NEED_int8_t
  4. #define __NEED_int16_t
  5. #define __NEED_int32_t
  6. #define __NEED_int64_t
  7. #define __NEED_uint8_t
  8. #define __NEED_uint16_t
  9. #define __NEED_uint32_t
  10. #define __NEED_uint64_t
  11. #define __NEED_intptr_t
  12. #define __NEED_uintptr_t
  13. #define __NEED_intmax_t
  14. #define __NEED_uintmax_t
  15. #include <bits/alltypes.h>
  16. typedef int8_t int_fast8_t;
  17. typedef int64_t int_fast64_t;
  18. typedef int8_t int_least8_t;
  19. typedef int16_t int_least16_t;
  20. typedef int32_t int_least32_t;
  21. typedef int64_t int_least64_t;
  22. typedef uint8_t uint_fast8_t;
  23. typedef uint64_t uint_fast64_t;
  24. typedef uint8_t uint_least8_t;
  25. typedef uint16_t uint_least16_t;
  26. typedef uint32_t uint_least32_t;
  27. typedef uint64_t uint_least64_t;
  28. #define INT8_MIN (-1-0x7f)
  29. #define INT16_MIN (-1-0x7fff)
  30. #define INT32_MIN (-1-0x7fffffff)
  31. #define INT64_MIN (-1-0x7fffffffffffffff)
  32. #define INT8_MAX (0x7f)
  33. #define INT16_MAX (0x7fff)
  34. #define INT32_MAX (0x7fffffff)
  35. #define INT64_MAX (0x7fffffffffffffff)
  36. #define UINT8_MAX (0xff)
  37. #define UINT16_MAX (0xffff)
  38. #define UINT32_MAX (0xffffffffu)
  39. #define UINT64_MAX (0xffffffffffffffffu)
  40. #define INT_FAST8_MIN INT8_MIN
  41. #define INT_FAST64_MIN INT64_MIN
  42. #define INT_LEAST8_MIN INT8_MIN
  43. #define INT_LEAST16_MIN INT16_MIN
  44. #define INT_LEAST32_MIN INT32_MIN
  45. #define INT_LEAST64_MIN INT64_MIN
  46. #define INT_FAST8_MAX INT8_MAX
  47. #define INT_FAST64_MAX INT64_MAX
  48. #define INT_LEAST8_MAX INT8_MAX
  49. #define INT_LEAST16_MAX INT16_MAX
  50. #define INT_LEAST32_MAX INT32_MAX
  51. #define INT_LEAST64_MAX INT64_MAX
  52. #define UINT_FAST8_MAX UINT8_MAX
  53. #define UINT_FAST64_MAX UINT64_MAX
  54. #define UINT_LEAST8_MAX UINT8_MAX
  55. #define UINT_LEAST16_MAX UINT16_MAX
  56. #define UINT_LEAST32_MAX UINT32_MAX
  57. #define UINT_LEAST64_MAX UINT64_MAX
  58. #define INTMAX_MIN INT64_MIN
  59. #define INTMAX_MAX INT64_MAX
  60. #define UINTMAX_MAX UINT64_MAX
  61. #define WINT_MIN 0U
  62. #define WINT_MAX UINT32_MAX
  63. #if L'\0'-1 > 0
  64. #define WCHAR_MAX (0xffffffffu+L'\0')
  65. #define WCHAR_MIN (0+L'\0')
  66. #else
  67. #define WCHAR_MAX (0x7fffffff+L'\0')
  68. #define WCHAR_MIN (-1-0x7fffffff+L'\0')
  69. #endif
  70. #define SIG_ATOMIC_MIN INT32_MIN
  71. #define SIG_ATOMIC_MAX INT32_MAX
  72. #include <bits/stdint.h>
  73. #define INT8_C(c) c
  74. #define INT16_C(c) c
  75. #define INT32_C(c) c
  76. #define UINT8_C(c) c
  77. #define UINT16_C(c) c
  78. #define UINT32_C(c) c ## U
  79. #if UINTPTR_MAX == UINT64_MAX
  80. #define INT64_C(c) c ## L
  81. #define UINT64_C(c) c ## UL
  82. #define INTMAX_C(c) c ## L
  83. #define UINTMAX_C(c) c ## UL
  84. #else
  85. #define INT64_C(c) c ## LL
  86. #define UINT64_C(c) c ## ULL
  87. #define INTMAX_C(c) c ## LL
  88. #define UINTMAX_C(c) c ## ULL
  89. #endif
  90. #endif