summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorCharles Bailey <bailey@newman.upenn.edu>1998-03-01 20:41:41 -0500
committerMalcolm Beattie <mbeattie@sable.ox.ac.uk>1998-03-05 18:53:13 +0000
commitef2f54b068d6db9a696444bbfd2ffbf3ed35f3d3 (patch)
tree48a3c0aff8157c455e392e06c048e77215e10458 /perl.h
parent12cbd72080d6b000bbed2e06a5c3723a60aeea34 (diff)
downloadperl-ef2f54b068d6db9a696444bbfd2ffbf3ed35f3d3.tar.gz
USHRT range limit macros
p4raw-id: //depot/perl@778
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/perl.h b/perl.h
index 49032b55e1..2c4ee91409 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 <values.h> */
# 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