limits.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*-------------------------------------------------------------------------
  2. limits.h - ANSI defines constants for sizes of integral types
  3. Copyright (C) 1999, Sandeep Dutta . sandeep.dutta@usa.net
  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 __SDC51_LIMITS_H
  24. #define __SDC51_LIMITS_H 1
  25. #define CHAR_BIT 8 /* bits in a char */
  26. #define SCHAR_MAX 127
  27. #define SCHAR_MIN -128
  28. #define UCHAR_MAX 0xff
  29. #ifdef __SDCC_CHAR_UNSIGNED
  30. #define CHAR_MAX UCHAR_MAX
  31. #define CHAR_MIN 0
  32. #else
  33. #define CHAR_MAX SCHAR_MAX
  34. #define CHAR_MIN SCHAR_MIN
  35. #endif
  36. #define MB_LEN_MAX 1
  37. #define INT_MIN -32768
  38. #define INT_MAX 32767
  39. #define SHRT_MAX INT_MAX
  40. #define SHRT_MIN INT_MIN
  41. #define UINT_MAX 0xffff
  42. #define UINT_MIN 0
  43. #define USHRT_MAX UINT_MAX
  44. #define USHRT_MIN UINT_MIN
  45. #define LONG_MIN (-2147483647L-1)
  46. #define LONG_MAX 2147483647L
  47. #define ULONG_MAX 0xffffffff
  48. #define ULONG_MIN 0
  49. #define LLONG_MIN (-9223372036854775807LL-1)
  50. #define LLONG_MAX 9223372036854775807LL
  51. #define ULLONG_MAX 18446744073709551615ULL
  52. #endif