From 51da3560e0f89359b53d63f90ee422e95872be45 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Tue, 26 Jun 2001 16:56:06 +0000 Subject: [PATCH] glimits.h (USHRT_MAX): Use unsigned suffix if int can not hold it. 2001-06-26 Vladimir Makarov * glimits.h (USHRT_MAX): Use unsigned suffix if int can not hold it. From-SVN: r43584 --- gcc/ChangeLog | 5 +++++ gcc/glimits.h | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 03e00157d75..d1dac4c50de 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2001-06-26 Vladimir Makarov + + * glimits.h (USHRT_MAX): Use unsigned suffix if int can not hold + it. + 2001-06-26 Gabriel Dos Reis * diagnostic.h (struct diagnostic_context): Add new field. diff --git a/gcc/glimits.h b/gcc/glimits.h index 979e7155803..f0cb0a3bba4 100644 --- a/gcc/glimits.h +++ b/gcc/glimits.h @@ -44,10 +44,6 @@ #undef SHRT_MAX #define SHRT_MAX 32767 -/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ -#undef USHRT_MAX -#define USHRT_MAX 65535 - /* Minimum and maximum values a `signed int' can hold. */ #ifndef __INT_MAX__ #define __INT_MAX__ 2147483647 @@ -57,6 +53,14 @@ #undef INT_MAX #define INT_MAX __INT_MAX__ +/* Maximum value an `unsigned short int' can hold. (Minimum is 0). */ +#undef USHRT_MAX +#if INT_MAX < 65535 +#define USHRT_MAX 65535U +#else +#define USHRT_MAX 65535 +#endif + /* Maximum value an `unsigned int' can hold. (Minimum is 0). */ #undef UINT_MAX #define UINT_MAX (INT_MAX * 2U + 1)