1
0

limits.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * This file is part of Jehanne.
  3. *
  4. * Copyright (C) 2016-2019 Giacomo Tesio <giacomo@tesio.it>
  5. *
  6. * Jehanne is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, version 3 of the License.
  9. *
  10. * Jehanne is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #ifndef _JEHANNE_LIMITS_H
  19. #define _JEHANNE_LIMITS_H
  20. #undef CHAR_BIT
  21. #define CHAR_BIT __CHAR_BIT__
  22. #ifndef MB_LEN_MAX
  23. #define MB_LEN_MAX 4 /* UTFmax in libc.h */
  24. #endif
  25. #define SCHAR_MAX 127
  26. #define SCHAR_MIN (-128)
  27. #define UCHAR_MAX (SCHAR_MAX * 2 + 1)
  28. /* Jehanne's chars are signed */
  29. #define CHAR_MIN SCHAR_MIN
  30. #define CHAR_MAX SCHAR_MAX
  31. #define SHRT_MIN (-32768)
  32. #define SHRT_MAX 32767
  33. #define USHRT_MAX 65535
  34. #define INT_MIN (-INT_MAX - 1)
  35. #define INT_MAX 2147483647
  36. #define UINT_MAX 4294967295U
  37. #define LONG_MAX 9223372036854775807L
  38. #define LONG_MIN (-LONG_MAX - 1L)
  39. #define ULONG_MAX 18446744073709551615UL
  40. #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
  41. /* Minimum and maximum values a `signed long long int' can hold. */
  42. #define LLONG_MAX 9223372036854775807LL
  43. #define LLONG_MIN (-LLONG_MAX - 1LL)
  44. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0.) */
  45. # define ULLONG_MAX 18446744073709551615ULL
  46. # endif /* ISO C99 */
  47. #if defined (__GNU_LIBRARY__) ? defined (__USE_GNU) : !defined (__STRICT_ANSI__)
  48. /* Minimum and maximum values a `signed long long int' can hold. */
  49. # undef LONG_LONG_MIN
  50. # define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
  51. # undef LONG_LONG_MAX
  52. # define LONG_LONG_MAX 9223372036854775807L
  53. /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */
  54. # undef ULONG_LONG_MAX
  55. # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
  56. #endif
  57. #ifdef __STDC_WANT_IEC_60559_BFP_EXT__
  58. /* TS 18661-1 widths of integer types. */
  59. # undef CHAR_WIDTH
  60. # define CHAR_WIDTH 8
  61. # undef SCHAR_WIDTH
  62. # define SCHAR_WIDTH 8
  63. # undef UCHAR_WIDTH
  64. # define UCHAR_WIDTH 8
  65. # undef SHRT_WIDTH
  66. # define SHRT_WIDTH 16
  67. # undef USHRT_WIDTH
  68. # define USHRT_WIDTH 16
  69. # undef INT_WIDTH
  70. # define INT_WIDTH 32
  71. # undef UINT_WIDTH
  72. # define UINT_WIDTH 32
  73. # undef LONG_WIDTH
  74. # define LONG_WIDTH 64
  75. # undef ULONG_WIDTH
  76. # define ULONG_WIDTH 64
  77. # undef LLONG_WIDTH
  78. # define LLONG_WIDTH 64
  79. # undef ULLONG_WIDTH
  80. # define ULLONG_WIDTH 64
  81. #endif
  82. #endif /* _LIMITS_H___ */