summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2021-01-07 14:45:40 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2021-01-07 14:45:40 (GMT)
commitad4c7a03b7ca435630c9f77c85536dca2ca07f2a (patch)
treed23ea743e0db0cc15e109cb3cda7672942730e1a /generic
parent76fd53b302b65b7036811a4a56c844c39f3ea55c (diff)
downloadtcl-ad4c7a03b7ca435630c9f77c85536dca2ca07f2a.zip
tcl-ad4c7a03b7ca435630c9f77c85536dca2ca07f2a.tar.gz
tcl-ad4c7a03b7ca435630c9f77c85536dca2ca07f2a.tar.bz2
Revise UWIDE_MAX and friends
Diffstat (limited to 'generic')
-rw-r--r--generic/tclPort.h6
-rw-r--r--generic/tclStrToD.c10
2 files changed, 8 insertions, 8 deletions
diff --git a/generic/tclPort.h b/generic/tclPort.h
index d3f6233..e927620 100644
--- a/generic/tclPort.h
+++ b/generic/tclPort.h
@@ -24,8 +24,8 @@
#endif
#include "tcl.h"
-#define UWIDE_MAX ((Tcl_WideUInt)-1)
-#define WIDE_MAX ((Tcl_WideInt)(UWIDE_MAX >> 1))
-#define WIDE_MIN ((Tcl_WideInt)((Tcl_WideUInt)WIDE_MAX+1))
+#define UWIDE_MAX ULLONG_MAX
+#define WIDE_MAX LLONG_MAX
+#define WIDE_MIN LLONG_MIN
#endif /* _TCLPORT */
diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c
index 2f870c6..b5c0ca2 100644
--- a/generic/tclStrToD.c
+++ b/generic/tclStrToD.c
@@ -538,7 +538,7 @@ TclParseNumber(
int under = 0; /* Flag trailing '_' as error if true once
* number is accepted. */
-#define ALL_BITS ((Tcl_WideUInt)-1)
+#define ALL_BITS UWIDE_MAX
#define MOST_BITS (ALL_BITS >> 1)
/*
@@ -725,7 +725,7 @@ TclParseNumber(
&& (((size_t)shift >=
CHAR_BIT*sizeof(Tcl_WideUInt))
|| (octalSignificandWide >
- ((Tcl_WideUInt)-1 >> shift)))) {
+ (UWIDE_MAX >> shift)))) {
octalSignificandOverflow = 1;
err = mp_init_u64(&octalSignificandBig,
octalSignificandWide);
@@ -865,7 +865,7 @@ TclParseNumber(
if (significandWide != 0 &&
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
- significandWide > ((Tcl_WideUInt)-1 >> shift))) {
+ significandWide > (UWIDE_MAX >> shift))) {
significandOverflow = 1;
err = mp_init_u64(&significandBig,
significandWide);
@@ -917,7 +917,7 @@ TclParseNumber(
if (significandWide != 0 &&
((size_t)shift >= CHAR_BIT*sizeof(Tcl_WideUInt) ||
- significandWide > ((Tcl_WideUInt)-1 >> shift))) {
+ significandWide > (UWIDE_MAX >> shift))) {
significandOverflow = 1;
err = mp_init_u64(&significandBig,
significandWide);
@@ -1597,7 +1597,7 @@ AccumulateDecimalDigit(
*wideRepPtr = digit;
return 0;
} else if (numZeros >= maxpow10_wide
- || w > ((Tcl_WideUInt)-1-digit)/pow10_wide[numZeros+1]) {
+ || w > (UWIDE_MAX-digit)/pow10_wide[numZeros+1]) {
/*
* Wide multiplication will overflow. Expand the number to a
* bignum and fall through into the bignum case.