From a57d5061ff47d6f84d5eee6b7c869cf1899d9917 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 31 Mar 1998 23:11:37 +0000 Subject: (TYPE_MAXIMUM): Cast result to `(t)' so this macro works with `unsigned char'. From Greg Wooledge. (SCHAR_MIN, SCHAR_MAX, SHRT_MIN, SHRT_MAX, LONG_MAX, ULONG_MAX): Define. --- src/system.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/system.h b/src/system.h index 53cbff081..84ac9cd68 100644 --- a/src/system.h +++ b/src/system.h @@ -124,7 +124,27 @@ It is necessary at least when t == time_t. */ #define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \ ? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0)) -#define TYPE_MAXIMUM(t) (~ (t) 0 - TYPE_MINIMUM (t)) +#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t))) + +#ifndef SCHAR_MIN +# define SCHAR_MIN TYPE_MINIMUM (char) +#endif + +#ifndef SCHAR_MAX +# define SCHAR_MAX TYPE_MAXIMUM (char) +#endif + +#ifndef UCHAR_MAX +# define UCHAR_MAX TYPE_MAXIMUM (unsigned char) +#endif + +#ifndef SHRT_MIN +# define SHRT_MIN TYPE_MINIMUM (short int) +#endif + +#ifndef SHRT_MAX +# define SHRT_MAX TYPE_MAXIMUM (short int) +#endif #ifndef INT_MAX # define INT_MAX TYPE_MAXIMUM (int) @@ -134,6 +154,14 @@ # define UINT_MAX TYPE_MAXIMUM (unsigned int) #endif +#ifndef LONG_MAX +# define LONG_MAX TYPE_MAXIMUM (long) +#endif + +#ifndef ULONG_MAX +# define ULONG_MAX TYPE_MAXIMUM (unsigned long) +#endif + #include "pathmax.h" #ifdef TM_IN_SYS_TIME -- cgit v1.2.3-70-g09d2