stdint.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. *
  11. * 2. Redistributions in binary form must reproduce the above copyright notice,
  12. * this list of conditions and the following disclaimer in the documentation
  13. * and/or other materials provided with the distribution.
  14. *
  15. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  16. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  17. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  18. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  19. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  20. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  21. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  22. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  24. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. */
  26. #pragma once
  27. #include <sys/cdefs.h>
  28. __BEGIN_DECLS
  29. typedef __UINT64_TYPE__ uint64_t;
  30. typedef __UINT32_TYPE__ uint32_t;
  31. typedef __UINT16_TYPE__ uint16_t;
  32. typedef __UINT8_TYPE__ uint8_t;
  33. typedef __INT64_TYPE__ int64_t;
  34. typedef __INT32_TYPE__ int32_t;
  35. typedef __INT16_TYPE__ int16_t;
  36. typedef __INT8_TYPE__ int8_t;
  37. typedef __UINT_FAST8_TYPE__ uint_fast8_t;
  38. typedef __UINT_FAST16_TYPE__ uint_fast16_t;
  39. typedef __UINT_FAST32_TYPE__ uint_fast32_t;
  40. typedef __UINT_FAST64_TYPE__ uint_fast64_t;
  41. typedef __INT_FAST8_TYPE__ int_fast8_t;
  42. typedef __INT_FAST16_TYPE__ int_fast16_t;
  43. typedef __INT_FAST32_TYPE__ int_fast32_t;
  44. typedef __INT_FAST64_TYPE__ int_fast64_t;
  45. typedef __UINT_LEAST8_TYPE__ uint_least8_t;
  46. typedef __UINT_LEAST16_TYPE__ uint_least16_t;
  47. typedef __UINT_LEAST32_TYPE__ uint_least32_t;
  48. typedef __UINT_LEAST64_TYPE__ uint_least64_t;
  49. typedef __INT_LEAST8_TYPE__ int_least8_t;
  50. typedef __INT_LEAST16_TYPE__ int_least16_t;
  51. typedef __INT_LEAST32_TYPE__ int_least32_t;
  52. typedef __INT_LEAST64_TYPE__ int_least64_t;
  53. #define __int8_t_defined 1
  54. #define __uint8_t_defined 1
  55. #define __int16_t_defined 1
  56. #define __uint16_t_defined 1
  57. #define __int32_t_defined 1
  58. #define __uint32_t_defined 1
  59. #define __int64_t_defined 1
  60. #define __uint64_t_defined 1
  61. typedef __UINTPTR_TYPE__ uintptr_t;
  62. typedef __INTPTR_TYPE__ intptr_t;
  63. typedef __UINTMAX_TYPE__ uintmax_t;
  64. #define UINTMAX_MAX __UINTMAX_MAX__
  65. #define UINTMAX_MIN __UINTMAX_MIN__
  66. typedef __INTMAX_TYPE__ intmax_t;
  67. #define INTMAX_MAX __INTMAX_MAX__
  68. #define INTMAX_MIN (-INTMAX_MAX - 1)
  69. #define INT8_MIN (-128)
  70. #define INT16_MIN (-32767 - 1)
  71. #define INT32_MIN (-2147483647 - 1)
  72. #define INT64_MIN (-9223372036854775807LL - 1LL)
  73. #define INT8_MAX (127)
  74. #define INT16_MAX (32767)
  75. #define INT32_MAX (2147483647)
  76. #define INT64_MAX (9223372036854775807LL)
  77. #define UINT8_MAX (255)
  78. #define UINT16_MAX (65535)
  79. #define UINT32_MAX (4294967295U)
  80. #define UINT64_MAX (18446744073709551615ULL)
  81. #define INTPTR_MAX INT32_MAX
  82. #define INTPTR_MIN INT32_MIN
  83. #define UINTPTR_MAX UINT32_MAX
  84. #define INT_FAST8_MIN INT8_MIN
  85. #define INT_FAST16_MIN INT16_MIN
  86. #define INT_FAST32_MIN INT32_MIN
  87. #define INT_FAST64_MIN INT64_MIN
  88. #define INT_FAST8_MAX INT8_MAX
  89. #define INT_FAST16_MAX INT16_MAX
  90. #define INT_FAST32_MAX INT32_MAX
  91. #define INT_FAST64_MAX INT64_MAX
  92. #define UINT_FAST8_MAX UINT8_MAX
  93. #define UINT_FAST16_MAX UINT16_MAX
  94. #define UINT_FAST32_MAX UINT32_MAX
  95. #define UINT_FAST64_MAX UINT64_MAX
  96. #define INT_LEAST8_MIN INT8_MIN
  97. #define INT_LEAST16_MIN INT16_MIN
  98. #define INT_LEAST32_MIN INT32_MIN
  99. #define INT_LEAST64_MIN INT64_MIN
  100. #define INT_LEAST8_MAX INT8_MAX
  101. #define INT_LEAST16_MAX INT16_MAX
  102. #define INT_LEAST32_MAX INT32_MAX
  103. #define INT_LEAST64_MAX INT64_MAX
  104. #define UINT_LEAST8_MAX UINT8_MAX
  105. #define UINT_LEAST16_MAX UINT16_MAX
  106. #define UINT_LEAST32_MAX UINT32_MAX
  107. #define UINT_LEAST64_MAX UINT64_MAX
  108. #define INT8_C(x) x
  109. #define UINT8_C(x) x
  110. #define INT16_C(x) x
  111. #define UINT16_C(x) x
  112. #define INT32_C(x) x
  113. #define UINT32_C(x) x
  114. #define INT64_C(x) x##LL
  115. #define UINT64_C(x) x##ULL
  116. #define SIZE_MAX ((size_t)-1)
  117. __END_DECLS