Tcl Source Code

Check-in [e03ac1dc7c]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix MSVC warning: warning C4146: unary minus operator applied to unsigned type, result still unsigned (hopefully)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-branch
Files: files | file ages | folders
SHA3-256: e03ac1dc7c1a017210982890a56d5dbe77ef3e1f876c3735b6743f4b242fb53f
User & Date: jan.nijtmans 2018-10-08 20:47:26
Context
2018-10-08
22:32
Tcl_GetStringFromObj -> Tcl_GetString check-in: e6d2130f9e user: jan.nijtmans tags: core-8-branch
22:22
Re-base to 8.7 check-in: e007a2ab3c user: jan.nijtmans tags: tip-481
20:47
Fix MSVC warning: warning C4146: unary minus operator applied to unsigned type, result still unsign... check-in: e03ac1dc7c user: jan.nijtmans tags: core-8-branch
19:08
TIP #514 implementation: Platform differences in handling int/wide check-in: d0f4e9da90 user: jan.nijtmans tags: core-8-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclObj.c.

3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
		unsigned char *bytes = (unsigned char *) &scratch;

		if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
		    while (numBytes-- > 0) {
			value = (value << CHAR_BIT) | *bytes++;
		    }
		    if (big.sign) {
			if (value <= -(Tcl_WideUInt)WIDE_MIN) {
			    *wideIntPtr = - (Tcl_WideInt) value;
			    return TCL_OK;
			}
		    } else {
			if (value <= (Tcl_WideUInt)WIDE_MAX) {
			    *wideIntPtr = (Tcl_WideInt) value;
			    return TCL_OK;






|







3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
		unsigned char *bytes = (unsigned char *) &scratch;

		if (mp_to_unsigned_bin_n(&big, bytes, &numBytes) == MP_OKAY) {
		    while (numBytes-- > 0) {
			value = (value << CHAR_BIT) | *bytes++;
		    }
		    if (big.sign) {
			if (value <= 1 + ~(Tcl_WideUInt)WIDE_MIN) {
			    *wideIntPtr = - (Tcl_WideInt) value;
			    return TCL_OK;
			}
		    } else {
			if (value <= (Tcl_WideUInt)WIDE_MAX) {
			    *wideIntPtr = (Tcl_WideInt) value;
			    return TCL_OK;