diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-19 22:04:09 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-12-19 22:04:09 (GMT) |
commit | 2c3a603e13f233051a110efb75f1c3a357acad1f (patch) | |
tree | 17cdbb378af53c47f031ab8d6f74ac13ca793dfe /generic | |
parent | 4e6d44d0e6ebe87c10f3fbab33a2b0072038ea67 (diff) | |
parent | a0f11eae42f9260f584f97332464ac95c9713062 (diff) | |
download | tcl-2c3a603e13f233051a110efb75f1c3a357acad1f.zip tcl-2c3a603e13f233051a110efb75f1c3a357acad1f.tar.gz tcl-2c3a603e13f233051a110efb75f1c3a357acad1f.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclUtil.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 659796e..24e2a11 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -3615,10 +3615,10 @@ TclFormatInt( * formatted characters are written. */ Tcl_WideInt n) /* The integer to format. */ { - Tcl_WideInt intVal; + Tcl_WideUInt intVal; int i; int numFormatted, j; - const char *digits = "0123456789"; + static const char digits[] = "0123456789"; /* * Check first whether "n" is zero. @@ -3631,27 +3631,16 @@ TclFormatInt( } /* - * Check whether "n" is the maximum negative value. This is -2^(m-1) for - * an m-bit word, and has no positive equivalent; negating it produces the - * same value. - */ - - intVal = -n; /* [Bug 3390638] Workaround for*/ - if (n == -n || intVal == n) { /* broken compiler optimizers. */ - return sprintf(buffer, "%" TCL_LL_MODIFIER "d", n); - } - - /* * Generate the characters of the result backwards in the buffer. */ - intVal = (n < 0? -n : n); + intVal = (n < 0 ? -n : n); i = 0; buffer[0] = '\0'; do { i++; buffer[i] = digits[intVal % 10]; - intVal = intVal/10; + intVal = intVal / 10; } while (intVal > 0); if (n < 0) { i++; |