#ifndef _LIMITS_H___
-#ifndef _MACH_MACHLIMITS_H_
-
-/* _MACH_MACHLIMITS_H_ is used on OSF/1. */
#define _LIMITS_H___
-#define _MACH_MACHLIMITS_H_
/* Number of bits in a `char'. */
#undef CHAR_BIT
#define CHAR_MAX 127
#endif
+#ifndef __SHRT_MAX__
+#define __SHRT_MAX__ 32767
+#endif
+
/* Minimum and maximum values a `signed short int' can hold. */
#undef SHRT_MIN
-/* For the sake of 16 bit hosts, we may not use -32768 */
-#define SHRT_MIN (-32767-1)
+#define SHRT_MIN (-SHRT_MAX-1)
#undef SHRT_MAX
-#define SHRT_MAX 32767
+#define SHRT_MAX __SHRT_MAX__
/* Minimum and maximum values a `signed int' can hold. */
#ifndef __INT_MAX__
/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */
#undef USHRT_MAX
-#if INT_MAX < 65535
-#define USHRT_MAX 65535U
+#if __SHRT_MAX__ == __INT_MAX__
+#define USHRT_MAX (SHRT_MAX * 2U + 1U)
#else
-#define USHRT_MAX 65535
+#define USHRT_MAX (SHRT_MAX * 2 + 1)
#endif
/* Maximum value an `unsigned int' can hold. (Minimum is 0). */
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1)
#endif
-#endif /* _MACH_MACHLIMITS_H_ */
#endif /* _LIMITS_H___ */