diff options
author | Jim Meyering <jim@meyering.net> | 1998-03-31 23:11:37 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1998-03-31 23:11:37 +0000 |
commit | a57d5061ff47d6f84d5eee6b7c869cf1899d9917 (patch) | |
tree | dd35b7634613de30c193c566eda31869c51c1c06 /src | |
parent | 45e8e5c550c1ba88a8e3f0d8ffdeeb16627568a4 (diff) | |
download | coreutils-a57d5061ff47d6f84d5eee6b7c869cf1899d9917.tar.xz |
(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.
Diffstat (limited to 'src')
-rw-r--r-- | src/system.h | 30 |
1 files changed, 29 insertions, 1 deletions
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 |