stdint.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*-------------------------------------------------------------------------
  2. stdint.h - ISO C99 7.18 Integer types <stdint.h>
  3. Copyright (C) 2005, Maarten Brock <sourceforge.brock AT dse.nl>
  4. This library is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this library; see the file COPYING. If not, write to the
  14. Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  15. MA 02110-1301, USA.
  16. As a special exception, if you link this library with other files,
  17. some of which are compiled with SDCC, to produce an executable,
  18. this library does not by itself cause the resulting executable to
  19. be covered by the GNU General Public License. This exception does
  20. not however invalidate any other reasons why the executable file
  21. might be covered by the GNU General Public License.
  22. -------------------------------------------------------------------------*/
  23. #ifndef _STDINT_H
  24. #define _STDINT_H 1
  25. /* Exact integral types. */
  26. /* Signed. */
  27. typedef signed char int8_t;
  28. typedef short int int16_t;
  29. typedef long int int32_t;
  30. /* Unsigned. */
  31. typedef unsigned char uint8_t;
  32. typedef unsigned short int uint16_t;
  33. typedef unsigned long int uint32_t;
  34. /* Small types. */
  35. /* Signed. */
  36. typedef signed char int_least8_t;
  37. typedef short int int_least16_t;
  38. typedef long int int_least32_t;
  39. /* Unsigned. */
  40. typedef unsigned char uint_least8_t;
  41. typedef unsigned short int uint_least16_t;
  42. typedef unsigned long int uint_least32_t;
  43. /* Fast types. */
  44. /* Signed. */
  45. typedef signed char int_fast8_t;
  46. typedef int int_fast16_t;
  47. typedef long int int_fast32_t;
  48. /* Unsigned. */
  49. typedef unsigned char uint_fast8_t;
  50. typedef unsigned int uint_fast16_t;
  51. typedef unsigned long int uint_fast32_t;
  52. /* Types for `void *' pointers. */
  53. typedef long int intptr_t;
  54. typedef unsigned long int uintptr_t;
  55. /* Largest integral types. */
  56. typedef long int intmax_t;
  57. typedef unsigned long int uintmax_t;
  58. /* Limits of integral types. */
  59. /* Minimum of signed integral types. */
  60. # define INT8_MIN (-128)
  61. # define INT16_MIN (-32767-1)
  62. # define INT32_MIN (-2147483647L-1)
  63. /* Maximum of signed integral types. */
  64. # define INT8_MAX (127)
  65. # define INT16_MAX (32767)
  66. # define INT32_MAX (2147483647L)
  67. /* Maximum of unsigned integral types. */
  68. # define UINT8_MAX (255)
  69. # define UINT16_MAX (65535)
  70. # define UINT32_MAX (4294967295UL)
  71. /* Minimum of signed integral types having a minimum size. */
  72. # define INT_LEAST8_MIN (-128)
  73. # define INT_LEAST16_MIN (-32767-1)
  74. # define INT_LEAST32_MIN (-2147483647L-1)
  75. /* Maximum of signed integral types having a minimum size. */
  76. # define INT_LEAST8_MAX (127)
  77. # define INT_LEAST16_MAX (32767)
  78. # define INT_LEAST32_MAX (2147483647L)
  79. /* Maximum of unsigned integral types having a minimum size. */
  80. # define UINT_LEAST8_MAX (255)
  81. # define UINT_LEAST16_MAX (65535)
  82. # define UINT_LEAST32_MAX (4294967295UL)
  83. /* Minimum of fast signed integral types having a minimum size. */
  84. # define INT_FAST8_MIN (-128)
  85. # define INT_FAST16_MIN (-32767-1)
  86. # define INT_FAST32_MIN (-2147483647L-1)
  87. /* Maximum of fast signed integral types having a minimum size. */
  88. # define INT_FAST8_MAX (127)
  89. # define INT_FAST16_MAX (32767)
  90. # define INT_FAST32_MAX (2147483647L)
  91. /* Maximum of fast unsigned integral types having a minimum size. */
  92. # define UINT_FAST8_MAX (255)
  93. # define UINT_FAST16_MAX (65535)
  94. # define UINT_FAST32_MAX (4294967295UL)
  95. /* Values to test for integral types holding `void *' pointer. */
  96. # define INTPTR_MIN (-2147483647L-1)
  97. # define INTPTR_MAX (2147483647L)
  98. # define UINTPTR_MAX (4294967295UL)
  99. /* Minimum for largest signed integral type. */
  100. # define INTMAX_MIN (-__INT32_C(-2147483647L)-1)
  101. /* Maximum for largest signed integral type. */
  102. # define INTMAX_MAX (__INT32_C(2147483647L))
  103. /* Maximum for largest unsigned integral type. */
  104. # define UINTMAX_MAX (__UINT32_C(4294967295UL))
  105. /* Limits of other integer types. */
  106. /* Limits of `ptrdiff_t' type. */
  107. # define PTRDIFF_MIN (-2147483647L-1)
  108. # define PTRDIFF_MAX (2147483647L)
  109. /* Limit of `size_t' type. */
  110. # define SIZE_MAX (65535)
  111. /* Signed. */
  112. # define INT8_C(c) c
  113. # define INT16_C(c) c
  114. # define INT32_C(c) c ## L
  115. /* Unsigned. */
  116. # define UINT8_C(c) c ## U
  117. # define UINT16_C(c) c ## U
  118. # define UINT32_C(c) c ## UL
  119. /* Maximal type. */
  120. # define INTMAX_C(c) c ## L
  121. # define UINTMAX_C(c) c ## UL
  122. #endif /* stdint.h */