home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / c / sozobon / sozlib15.zoo / sozdistr / include / xdlibs / limits.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-28  |  1.2 KB  |  46 lines

  1. /*
  2.  * @(#)limits.h, XdLibs, SozobonX
  3.  * 
  4.  */
  5.  
  6. #ifndef    _LIMITS_H
  7. #define    _LIMITS_H
  8.  
  9. #define    PATHSIZE    (128)        /* maximum pathname length */
  10.  
  11. #define    BITSPERBYTE    8
  12.  
  13. /* constants with only the high bit set */
  14. #define    HIBITS    ((short) (1 << (BITSPERBYTE * sizeof(short) - 1)))
  15. #define    HIBITI    ((int) (1 << (BITSPERBYTE * sizeof(int) - 1)))
  16. #define    HIBITL    ((long) (1L << (BITSPERBYTE * sizeof(long) - 1)))
  17.  
  18. /* largest value for each type */
  19. #define    MAXSHORT    ((short) (~HIBITS))
  20. #define    MAXINT        ((int) (~HIBITI))
  21. #define    MAXLONG        ((long) (~HIBITL))
  22.  
  23. /* smallest value for each type (assumes 2's complement representation) */
  24. #define    MINSHORT    HIBITS
  25. #define    MININT        HIBITI
  26. #define    MINLONG        HIBITL
  27.  
  28. /* similar #defines for ANSI compatibility */
  29. #define    CHAR_BIT    BITSPERBYTE
  30. #define    CHAR_MAX    SCHAR_MAX
  31. #define    CHAR_MIN    SCHAR_MIN
  32. #define    INT_MAX        MAXINT
  33. #define    INT_MIN        MININT
  34. #define    LONG_MAX    MAXLONG
  35. #define    LONG_MIN    MINLONG
  36. #define    SCHAR_MAX    (127)
  37. #define    SCHAR_MIN    (-128)
  38. #define    SHRT_MAX    MAXSHORT
  39. #define    SHRT_MIN    MINSHORT
  40. #define    UCHAR_MAX    ~((unsigned char) 0)
  41. #define    UINT_MAX    ~((unsigned int) 0)
  42. #define    ULONG_MAX    ~((unsigned long) 0)
  43. #define    USHRT_MAX    ~((unsigned short) 0)
  44.  
  45. #endif     /* _LIMITS_H    */
  46.