From: Charles Bailey Date: Mon, 2 Mar 1998 01:41:41 +0000 (-0500) Subject: USHRT range limit macros X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef2f54b068d6db9a696444bbfd2ffbf3ed35f3d3;p=p5sagit%2Fp5-mst-13.2.git USHRT range limit macros p4raw-id: //depot/perl@778 --- diff --git a/perl.h b/perl.h index 49032b5..2c4ee91 100644 --- a/perl.h +++ b/perl.h @@ -784,7 +784,11 @@ Free_t Perl_free _((Malloc_t where)); # ifdef MAXUSHORT # define PERL_USHORT_MAX ((unsigned short)MAXUSHORT) # else -# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) +# ifdef USHRT_MAX +# define PERL_USHORT_MAX ((unsigned short)USHRT_MAX) +# else +# define PERL_USHORT_MAX ((unsigned short)~(unsigned)0) +# endif # endif #endif @@ -794,7 +798,11 @@ Free_t Perl_free _((Malloc_t where)); # ifdef MAXSHORT /* Often used in */ # define PERL_SHORT_MAX ((short)MAXSHORT) # else -# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) +# ifdef SHRT_MAX +# define PERL_SHORT_MAX ((short)SHRT_MAX) +# else +# define PERL_SHORT_MAX ((short) (PERL_USHORT_MAX >> 1)) +# endif # endif #endif @@ -804,7 +812,11 @@ Free_t Perl_free _((Malloc_t where)); # ifdef MINSHORT # define PERL_SHORT_MIN ((short)MINSHORT) # else -# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) +# ifdef SHRT_MIN +# define PERL_SHORT_MIN ((short)SHRT_MIN) +# else +# define PERL_SHORT_MIN (-PERL_SHORT_MAX - ((3 & -1) == 3)) +# endif # endif #endif