stdint.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <sys/cdefs.h>
  8. __BEGIN_DECLS
  9. typedef __UINT64_TYPE__ uint64_t;
  10. typedef __UINT32_TYPE__ uint32_t;
  11. typedef __UINT16_TYPE__ uint16_t;
  12. typedef __UINT8_TYPE__ uint8_t;
  13. typedef __INT64_TYPE__ int64_t;
  14. typedef __INT32_TYPE__ int32_t;
  15. typedef __INT16_TYPE__ int16_t;
  16. typedef __INT8_TYPE__ int8_t;
  17. typedef __UINT_FAST8_TYPE__ uint_fast8_t;
  18. typedef __UINT_FAST16_TYPE__ uint_fast16_t;
  19. typedef __UINT_FAST32_TYPE__ uint_fast32_t;
  20. typedef __UINT_FAST64_TYPE__ uint_fast64_t;
  21. typedef __INT_FAST8_TYPE__ int_fast8_t;
  22. typedef __INT_FAST16_TYPE__ int_fast16_t;
  23. typedef __INT_FAST32_TYPE__ int_fast32_t;
  24. typedef __INT_FAST64_TYPE__ int_fast64_t;
  25. typedef __UINT_LEAST8_TYPE__ uint_least8_t;
  26. typedef __UINT_LEAST16_TYPE__ uint_least16_t;
  27. typedef __UINT_LEAST32_TYPE__ uint_least32_t;
  28. typedef __UINT_LEAST64_TYPE__ uint_least64_t;
  29. typedef __INT_LEAST8_TYPE__ int_least8_t;
  30. typedef __INT_LEAST16_TYPE__ int_least16_t;
  31. typedef __INT_LEAST32_TYPE__ int_least32_t;
  32. typedef __INT_LEAST64_TYPE__ int_least64_t;
  33. #define __int8_t_defined 1
  34. #define __uint8_t_defined 1
  35. #define __int16_t_defined 1
  36. #define __uint16_t_defined 1
  37. #define __int32_t_defined 1
  38. #define __uint32_t_defined 1
  39. #define __int64_t_defined 1
  40. #define __uint64_t_defined 1
  41. typedef __UINTPTR_TYPE__ uintptr_t;
  42. typedef __INTPTR_TYPE__ intptr_t;
  43. typedef __UINTMAX_TYPE__ uintmax_t;
  44. #define UINTMAX_MAX __UINTMAX_MAX__
  45. typedef __INTMAX_TYPE__ intmax_t;
  46. #define INTMAX_MAX __INTMAX_MAX__
  47. #define INTMAX_MIN (-INTMAX_MAX - 1)
  48. #define INT8_MIN (-128)
  49. #define INT16_MIN (-32767 - 1)
  50. #define INT32_MIN (-2147483647 - 1)
  51. #define INT64_MIN (-9223372036854775807LL - 1LL)
  52. #define INT8_MAX (127)
  53. #define INT16_MAX (32767)
  54. #define INT32_MAX (2147483647)
  55. #define INT64_MAX (9223372036854775807LL)
  56. #define UINT8_MAX (255)
  57. #define UINT16_MAX (65535)
  58. #define UINT32_MAX (4294967295U)
  59. #define UINT64_MAX (18446744073709551615ULL)
  60. #define INTPTR_MAX INT32_MAX
  61. #define INTPTR_MIN INT32_MIN
  62. #define UINTPTR_MAX UINT32_MAX
  63. #define INT_FAST8_MIN INT8_MIN
  64. #define INT_FAST16_MIN INT16_MIN
  65. #define INT_FAST32_MIN INT32_MIN
  66. #define INT_FAST64_MIN INT64_MIN
  67. #define INT_FAST8_MAX INT8_MAX
  68. #define INT_FAST16_MAX INT16_MAX
  69. #define INT_FAST32_MAX INT32_MAX
  70. #define INT_FAST64_MAX INT64_MAX
  71. #define UINT_FAST8_MAX UINT8_MAX
  72. #define UINT_FAST16_MAX UINT16_MAX
  73. #define UINT_FAST32_MAX UINT32_MAX
  74. #define UINT_FAST64_MAX UINT64_MAX
  75. #define INT_LEAST8_MIN INT8_MIN
  76. #define INT_LEAST16_MIN INT16_MIN
  77. #define INT_LEAST32_MIN INT32_MIN
  78. #define INT_LEAST64_MIN INT64_MIN
  79. #define INT_LEAST8_MAX INT8_MAX
  80. #define INT_LEAST16_MAX INT16_MAX
  81. #define INT_LEAST32_MAX INT32_MAX
  82. #define INT_LEAST64_MAX INT64_MAX
  83. #define UINT_LEAST8_MAX UINT8_MAX
  84. #define UINT_LEAST16_MAX UINT16_MAX
  85. #define UINT_LEAST32_MAX UINT32_MAX
  86. #define UINT_LEAST64_MAX UINT64_MAX
  87. #define INT8_C(x) x
  88. #define UINT8_C(x) x
  89. #define INT16_C(x) x
  90. #define UINT16_C(x) x
  91. #define INT32_C(x) x
  92. #define UINT32_C(x) x
  93. #define INT64_C(x) x##LL
  94. #define UINT64_C(x) x##ULL
  95. #define INTMAX_C(c) c##LL
  96. #define UINTMAX_C(c) c##ULL
  97. #define SIZE_MAX ((size_t)-1)
  98. __END_DECLS