limits.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*-------------------------------------------------------------------------
  2. limits.h - ANSI defines constants for sizes of integral types
  3. Copyright (C) 1999, Sandeep Dutta . sandeep.dutta@usa.net
  4. Adopted for the pic16 port by Vangelis Rokas <vrokas AT otenet.gr> 2004
  5. This library is free software; you can redistribute it and/or modify it
  6. under the terms of the GNU General Public License as published by the
  7. Free Software Foundation; either version 2, or (at your option) any
  8. later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this library; see the file COPYING. If not, write to the
  15. Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
  16. MA 02110-1301, USA.
  17. As a special exception, if you link this library with other files,
  18. some of which are compiled with SDCC, to produce an executable,
  19. this library does not by itself cause the resulting executable to
  20. be covered by the GNU General Public License. This exception does
  21. not however invalidate any other reasons why the executable file
  22. might be covered by the GNU General Public License.
  23. -------------------------------------------------------------------------*/
  24. #ifndef __LIMITS_H
  25. #define __LIMITS_H 1
  26. #define CHAR_BIT 8 /* bits in a char */
  27. #define SCHAR_MAX 127
  28. #define SCHAR_MIN -128
  29. #define UCHAR_MAX 0xff
  30. #define UCHAR_MIN 0
  31. #ifdef SDCC_CHAR_UNSIGNED
  32. #define CHAR_MAX UCHAR_MAX
  33. #define CHAR_MIN UCHAR_MIN
  34. #else
  35. #define CHAR_MAX SCHAR_MAX
  36. #define CHAR_MIN SCHAR_MIN
  37. #endif
  38. #define INT_MIN -32768
  39. #define INT_MAX 32767
  40. #define SHRT_MAX INT_MAX
  41. #define SHRT_MIN INT_MIN
  42. #define UINT_MAX 0xffff
  43. #define UINT_MIN 0
  44. #define USHRT_MAX UINT_MAX
  45. #define USHRT_MIN UINT_MIN
  46. #define LONG_MIN -2147483648
  47. #define LONG_MAX 2147483647
  48. #define ULONG_MAX 0xffffffff
  49. #define ULONG_MIN 0
  50. #endif