glimits.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /* Copyright (C) 1991-2015 Free Software Foundation, Inc.
  2. This file is part of GCC.
  3. GCC is free software; you can redistribute it and/or modify it under
  4. the terms of the GNU General Public License as published by the Free
  5. Software Foundation; either version 3, or (at your option) any later
  6. version.
  7. GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  8. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  10. for more details.
  11. Under Section 7 of GPL version 3, you are granted additional
  12. permissions described in the GCC Runtime Library Exception, version
  13. 3.1, as published by the Free Software Foundation.
  14. You should have received a copy of the GNU General Public License and
  15. a copy of the GCC Runtime Library Exception along with this program;
  16. see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  17. <http://www.gnu.org/licenses/>. */
  18. #ifndef _LIMITS_H___
  19. #define _LIMITS_H___
  20. /* Number of bits in a `char'. */
  21. #undef CHAR_BIT
  22. #define CHAR_BIT __CHAR_BIT__
  23. /* Maximum length of a multibyte character. */
  24. #ifndef MB_LEN_MAX
  25. #define MB_LEN_MAX 1
  26. #endif
  27. /* Minimum and maximum values a `signed char' can hold. */
  28. #undef SCHAR_MIN
  29. #define SCHAR_MIN (-SCHAR_MAX - 1)
  30. #undef SCHAR_MAX
  31. #define SCHAR_MAX __SCHAR_MAX__
  32. /* Maximum value an `unsigned char' can hold. (Minimum is 0). */
  33. #undef UCHAR_MAX
  34. #if __SCHAR_MAX__ == __INT_MAX__
  35. # define UCHAR_MAX (SCHAR_MAX * 2U + 1U)
  36. #else
  37. # define UCHAR_MAX (SCHAR_MAX * 2 + 1)
  38. #endif
  39. /* Minimum and maximum values a `char' can hold. */
  40. #ifdef __CHAR_UNSIGNED__
  41. # undef CHAR_MIN
  42. # if __SCHAR_MAX__ == __INT_MAX__
  43. # define CHAR_MIN 0U
  44. # else
  45. # define CHAR_MIN 0
  46. # endif
  47. # undef CHAR_MAX
  48. # define CHAR_MAX UCHAR_MAX
  49. #else
  50. # undef CHAR_MIN
  51. # define CHAR_MIN SCHAR_MIN
  52. # undef CHAR_MAX
  53. # define CHAR_MAX SCHAR_MAX
  54. #endif
  55. /* Minimum and maximum values a `signed short int' can hold. */
  56. #undef SHRT_MIN
  57. #define SHRT_MIN (-SHRT_MAX - 1)
  58. #undef SHRT_MAX
  59. #define SHRT_MAX __SHRT_MAX__
  60. /* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
  61. #undef USHRT_MAX
  62. #if __SHRT_MAX__ == __INT_MAX__
  63. # define USHRT_MAX (SHRT_MAX * 2U + 1U)
  64. #else
  65. # define USHRT_MAX (SHRT_MAX * 2 + 1)
  66. #endif
  67. /* Minimum and maximum values a `signed int' can hold. */
  68. #undef INT_MIN
  69. #define INT_MIN (-INT_MAX - 1)
  70. #undef INT_MAX
  71. #define INT_MAX __INT_MAX__
  72. /* Maximum value an `unsigned int' can hold. (Minimum is 0). */
  73. #undef UINT_MAX
  74. #define UINT_MAX (INT_MAX * 2U + 1U)
  75. /* Minimum and maximum values a `signed long int' can hold.
  76. (Same as `int'). */
  77. #undef LONG_MIN
  78. #define LONG_MIN (-LONG_MAX - 1L)
  79. #undef LONG_MAX
  80. #define LONG_MAX __LONG_MAX__
  81. /* Maximum value an `unsigned long int' can hold. (Minimum is 0). */
  82. #undef ULONG_MAX
  83. #define ULONG_MAX (LONG_MAX * 2UL + 1UL)
  84. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  85. /* Minimum and maximum values a `signed long long int' can hold. */
  86. # undef LLONG_MIN
  87. # define LLONG_MIN (-LLONG_MAX - 1LL)
  88. # undef LLONG_MAX
  89. # define LLONG_MAX __LONG_LONG_MAX__
  90. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
  91. # undef ULLONG_MAX
  92. # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
  93. #endif
  94. #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
  95. /* Minimum and maximum values a `signed long long int' can hold. */
  96. # undef LONG_LONG_MIN
  97. # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
  98. # undef LONG_LONG_MAX
  99. # define LONG_LONG_MAX __LONG_LONG_MAX__
  100. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
  101. # undef ULONG_LONG_MAX
  102. # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
  103. #endif
  104. #endif /* _LIMITS_H___ */