Tcl Source Code

Artifact [40f8976bcd]
Login

Artifact 40f8976bcdbf5c297fc823b1178a54e6f0bbecfe:

Attachment "713562.patch" to ticket [713562ffff] added by dgp 2003-04-08 00:41:54.
Index: generic/tcl.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tcl.h,v
retrieving revision 1.156
diff -u -r1.156 tcl.h
--- generic/tcl.h	5 Apr 2003 01:25:10 -0000	1.156
+++ generic/tcl.h	7 Apr 2003 17:20:05 -0000
@@ -632,18 +632,13 @@
  */
 typedef enum {
     TCL_INT, TCL_DOUBLE, TCL_EITHER, TCL_WIDE_INT
-#ifdef TCL_WIDE_INT_IS_LONG
-    = TCL_INT
-#endif
 } Tcl_ValueType;
 typedef struct Tcl_Value {
     Tcl_ValueType type;		/* Indicates intValue or doubleValue is
 				 * valid, or both. */
     long intValue;		/* Integer value. */
     double doubleValue;		/* Double-precision floating value. */
-#ifndef TCL_WIDE_INT_IS_LONG
     Tcl_WideInt wideValue;	/* Wide (min. 64-bit) integer value. */
-#endif
 } Tcl_Value;
 
 /*
Index: generic/tclCmdAH.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdAH.c,v
retrieving revision 1.29
diff -u -r1.29 tclCmdAH.c
--- generic/tclCmdAH.c	14 Mar 2003 16:28:07 -0000	1.29
+++ generic/tclCmdAH.c	7 Apr 2003 17:20:06 -0000
@@ -1949,10 +1949,8 @@
 				 * it's a one-word value. */
     double doubleValue;		/* Used to hold value to pass to sprintf if
 				 * it's a double value. */
-#ifndef TCL_WIDE_INT_IS_LONG
     Tcl_WideInt wideValue;	/* Used to hold value to pass to sprintf if
 				 * it's a 'long long' value. */
-#endif /* TCL_WIDE_INT_IS_LONG */
     int whichValue;		/* Indicates which of intValue, ptrValue,
 				 * or doubleValue has the value to pass to
 				 * sprintf, according to the following
@@ -1991,9 +1989,7 @@
 				 * been set for the current field. */
     int gotZero;		/* Non-zero indicates that a zero flag has
 				 * been seen in the current field. */
-#ifndef TCL_WIDE_INT_IS_LONG
     int useWide;		/* Value to be printed is Tcl_WideInt. */
-#endif /* TCL_WIDE_INT_IS_LONG */
 
     /*
      * This procedure is a bit nasty.  The goal is to use sprintf to
@@ -2024,9 +2020,7 @@
 
 	width = precision = noPercent = useShort = 0;
 	gotZero = gotMinus = gotPrecision = 0;
-#ifndef TCL_WIDE_INT_IS_LONG
 	useWide = 0;
-#endif /* TCL_WIDE_INT_IS_LONG */
 	whichValue = PTR_VALUE;
 
 	/*
@@ -2170,7 +2164,6 @@
 	    }
 	}
 	if (*format == 'l') {
-#ifndef TCL_WIDE_INT_IS_LONG
 	    useWide = 1;
 	    /*
 	     * Only add a 'll' modifier for integer values as it makes
@@ -2186,7 +2179,6 @@
 		strcpy(newPtr, TCL_LL_MODIFIER);
 		newPtr += TCL_LL_MODIFIER_SIZE;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    format++;
 	} else if (*format == 'h') {
 	    useShort = 1;
@@ -2208,7 +2200,6 @@
 	case 'u':
 	case 'x':
 	case 'X':
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (useWide) {
 		if (Tcl_GetWideIntFromObj(interp, /* INTL: Tcl source. */
 			objv[objIndex], &wideValue) != TCL_OK) {
@@ -2218,7 +2209,6 @@
 		size = 40 + precision;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    if (Tcl_GetLongFromObj(interp,	      /* INTL: Tcl source. */
 		    objv[objIndex], &intValue) != TCL_OK) {
 		goto fmtError;
@@ -2319,11 +2309,9 @@
 	    case DOUBLE_VALUE:
 		sprintf(dst, newFormat, doubleValue); /* INTL: user locale. */
 		break;
-#ifndef TCL_WIDE_INT_IS_LONG
 	    case WIDE_VALUE:
 		sprintf(dst, newFormat, wideValue);
 		break;
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    case INT_VALUE:
 		if (useShort) {
 		    sprintf(dst, newFormat, (short) intValue);
Index: generic/tclCmdIL.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclCmdIL.c,v
retrieving revision 1.47
diff -u -r1.47 tclCmdIL.c
--- generic/tclCmdIL.c	27 Feb 2003 16:01:55 -0000	1.47
+++ generic/tclCmdIL.c	7 Apr 2003 17:20:06 -0000
@@ -323,12 +323,10 @@
     if (objc == 2) {
 	incrAmount = 1;
     } else {
-#ifdef TCL_WIDE_INT_IS_LONG
 	if (Tcl_GetLongFromObj(interp, objv[2], &incrAmount) != TCL_OK) {
 	    Tcl_AddErrorInfo(interp, "\n    (reading increment)");
 	    return TCL_ERROR;
 	}
-#else
 	/*
 	 * Need to be a bit cautious to ensure that [expr]-like rules
 	 * are enforced for interpretation of wide integers, despite
@@ -337,7 +335,7 @@
 	if (objv[2]->typePtr == &tclIntType) {
 	    incrAmount = objv[2]->internalRep.longValue;
 	} else if (objv[2]->typePtr == &tclWideIntType) {
-	    incrAmount = Tcl_WideAsLong(objv[2]->internalRep.wideValue);
+	    TclGetLongFromWide(incrAmount,objv[2]);
 	} else {
 	    Tcl_WideInt wide;
 
@@ -352,7 +350,6 @@
 		objv[2]->internalRep.longValue = incrAmount;
 	    }
 	}
-#endif
     }
     
     /*
Index: generic/tclDictObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclDictObj.c,v
retrieving revision 1.6
diff -u -r1.6 tclDictObj.c
--- generic/tclDictObj.c	7 Apr 2003 13:52:52 -0000	1.6
+++ generic/tclDictObj.c	7 Apr 2003 17:20:06 -0000
@@ -1712,7 +1712,6 @@
 	}
 	if (valuePtr == NULL) {
 	    valuePtr = Tcl_NewLongObj(incrValue);
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (valuePtr->typePtr == &tclWideIntType) {
 	    Tcl_GetWideIntFromObj(NULL, valuePtr, &wValue);
 	    if (Tcl_IsShared(valuePtr)) {
@@ -1724,7 +1723,6 @@
 		}
 		goto valueAlreadyInDictionary;
 	    }
-#endif /* !TCL_WIDE_INT_IS_LONG */
 	} else if (valuePtr->typePtr == &tclIntType) {
 	    Tcl_GetLongFromObj(NULL, valuePtr, &lValue);
 	    if (Tcl_IsShared(valuePtr)) {
Index: generic/tclExecute.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclExecute.c,v
retrieving revision 1.97
diff -u -r1.97 tclExecute.c
--- generic/tclExecute.c	1 Apr 2003 07:18:37 -0000	1.97
+++ generic/tclExecute.c	7 Apr 2003 17:20:06 -0000
@@ -258,18 +258,6 @@
 #   define O2S(objPtr)
 #endif /* TCL_COMPILE_DEBUG */
 
-
-/*
- * Most of the code to support working with wide values is factored
- * out here because it greatly reduces the number of conditionals
- * through the rest of the file.  Note that this needs to be
- * conditional because we do not want to alter Tcl's behaviour on
- * native-64bit platforms...
- */
-
-#ifndef TCL_WIDE_INT_IS_LONG
-#define W0	Tcl_LongAsWide(0)
-
 /*
  * Macro to read a string containing either a wide or an int and
  * decide which it is while decoding it at the same time.  This
@@ -297,19 +285,6 @@
 	(objPtr)->internalRep.longValue = (longVar)			\
 		= Tcl_WideAsLong(wideVar);				\
     }
-#define IS_INTEGER_TYPE(typePtr)					\
-	((typePtr) == &tclIntType || (typePtr) == &tclWideIntType)
-/*
- * Extract a double value from a general numeric object.
- */
-#define GET_DOUBLE_VALUE(doubleVar, objPtr, typePtr)			\
-    if ((typePtr) == &tclIntType) {					\
-	(doubleVar) = (double) (objPtr)->internalRep.longValue;		\
-    } else if ((typePtr) == &tclWideIntType) {				\
-	(doubleVar) = Tcl_WideAsDouble((objPtr)->internalRep.wideValue);\
-    } else {								\
-	(doubleVar) = (objPtr)->internalRep.doubleValue;		\
-    }
 /*
  * Combined with REQUIRE_WIDE_OR_INT, this gets a long value from
  * an obj.
@@ -318,34 +293,37 @@
     if ((objPtr)->typePtr == &tclWideIntType) {				\
 	(longVar) = Tcl_WideAsLong(wideVar);				\
     }
+#define IS_INTEGER_TYPE(typePtr)					\
+	((typePtr) == &tclIntType || (typePtr) == &tclWideIntType)
+#define IS_NUMERIC_TYPE(typePtr)					\
+	(IS_INTEGER_TYPE(typePtr) || (typePtr) == &tclDoubleType)
+
+#define W0	Tcl_LongAsWide(0)
 /*
  * For tracing that uses wide values.
  */
-#define LLTRACE(a)			TRACE(a)
-#define LLTRACE_WITH_OBJ(a,b)		TRACE_WITH_OBJ(a,b)
 #define LLD				"%" TCL_LL_MODIFIER "d"
-#else /* TCL_WIDE_INT_IS_LONG */
+
+#ifndef TCL_WIDE_INT_IS_LONG
 /*
- * Versions of the above that do not use wide values.
+ * Extract a double value from a general numeric object.
  */
-#define REQUIRE_WIDE_OR_INT(resultVar, objPtr, longVar, wideVar)	\
-    (resultVar) = Tcl_GetLongFromObj(interp, (objPtr), &(longVar));
-#define GET_WIDE_OR_INT(resultVar, objPtr, longVar, wideVar)		\
-    (resultVar) = Tcl_GetLongFromObj((Tcl_Interp *) NULL, (objPtr),	\
-	    &(longVar));
-#define IS_INTEGER_TYPE(typePtr) ((typePtr) == &tclIntType)
 #define GET_DOUBLE_VALUE(doubleVar, objPtr, typePtr)			\
     if ((typePtr) == &tclIntType) {					\
 	(doubleVar) = (double) (objPtr)->internalRep.longValue;		\
+    } else if ((typePtr) == &tclWideIntType) {				\
+	(doubleVar) = Tcl_WideAsDouble((objPtr)->internalRep.wideValue);\
+    } else {								\
+	(doubleVar) = (objPtr)->internalRep.doubleValue;		\
+    }
+#else /* TCL_WIDE_INT_IS_LONG */
+#define GET_DOUBLE_VALUE(doubleVar, objPtr, typePtr)			\
+    if (((typePtr) == &tclIntType) || ((typePtr) == &tclWideIntType)) { \
+	(doubleVar) = (double) (objPtr)->internalRep.longValue;		\
     } else {								\
 	(doubleVar) = (objPtr)->internalRep.doubleValue;		\
     }
-#define FORCE_LONG(objPtr, longVar, wideVar)
-#define LLTRACE(a)
-#define LLTRACE_WITH_OBJ(a,b)
 #endif /* TCL_WIDE_INT_IS_LONG */
-#define IS_NUMERIC_TYPE(typePtr)					\
-	(IS_INTEGER_TYPE(typePtr) || (typePtr) == &tclDoubleType)
 
 /*
  * Declarations for local procedures to this file:
@@ -371,10 +349,8 @@
 			    ExecEnv *eePtr, ClientData clientData));
 static int		ExprUnaryFunc _ANSI_ARGS_((Tcl_Interp *interp,
 			    ExecEnv *eePtr, ClientData clientData));
-#ifndef TCL_WIDE_INT_IS_LONG
 static int		ExprWideFunc _ANSI_ARGS_((Tcl_Interp *interp,
 			    ExecEnv *eePtr, ClientData clientData));
-#endif /* TCL_WIDE_INT_IS_LONG */
 #ifdef TCL_COMPILE_STATS
 static int              EvalStatsCmd _ANSI_ARGS_((ClientData clientData,
                             Tcl_Interp *interp, int objc,
@@ -437,11 +413,7 @@
     {"rand", 0, {TCL_EITHER}, ExprRandFunc, 0},	/* NOTE: rand takes no args. */
     {"round", 1, {TCL_EITHER}, ExprRoundFunc, 0},
     {"srand", 1, {TCL_INT}, ExprSrandFunc, 0},
-#ifdef TCL_WIDE_INT_IS_LONG
-    {"wide", 1, {TCL_EITHER}, ExprIntFunc, 0},
-#else
     {"wide", 1, {TCL_EITHER}, ExprWideFunc, 0},
-#endif /* TCL_WIDE_INT_IS_LONG */
     {0},
 };
 
@@ -1087,9 +1059,7 @@
     char *bytes;
     int length;
     long i = 0;			/* Init. avoids compiler warning. */
-#ifndef TCL_WIDE_INT_IS_LONG
     Tcl_WideInt w;
-#endif
     register int cleanup;
     Tcl_Obj *objResultPtr;
     char *part1, *part2;
@@ -1902,10 +1872,8 @@
 	valuePtr = stackPtr[stackTop];
 	if (valuePtr->typePtr == &tclIntType) {
 	    i = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (valuePtr->typePtr == &tclWideIntType) {
-	    i = Tcl_WideAsLong(valuePtr->internalRep.wideValue);
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetLongFromWide(i,valuePtr);
 	} else {
 	    REQUIRE_WIDE_OR_INT(result, valuePtr, i, w);
 	    if (result != TCL_OK) {
@@ -2092,10 +2060,9 @@
 		b = (valuePtr->internalRep.longValue != 0);
 	    } else if (valuePtr->typePtr == &tclDoubleType) {
 		b = (valuePtr->internalRep.doubleValue != 0.0);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (valuePtr->typePtr == &tclWideIntType) {
-		b = (valuePtr->internalRep.wideValue != W0);
-#endif /* TCL_WIDE_INT_IS_LONG */
+		TclGetWide(w,valuePtr);
+		b = (w != W0);
 	    } else {
 		result = Tcl_GetBooleanFromObj(interp, valuePtr, &b);
 		if (result != TCL_OK) {
@@ -2147,27 +2114,20 @@
 
 	if ((t1Ptr == &tclIntType) || (t1Ptr == &tclBooleanType)) {
 	    i1 = (valuePtr->internalRep.longValue != 0);
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (t1Ptr == &tclWideIntType) {
-	    i1 = (valuePtr->internalRep.wideValue != W0);
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w,valuePtr);
+	    i1 = (w != W0);
 	} else if (t1Ptr == &tclDoubleType) {
 	    i1 = (valuePtr->internalRep.doubleValue != 0.0);
 	} else {
 	    s = Tcl_GetStringFromObj(valuePtr, &length);
 	    if (TclLooksLikeInt(s, length)) {
-#ifdef TCL_WIDE_INT_IS_LONG
-		result = Tcl_GetLongFromObj((Tcl_Interp *) NULL,
-					    valuePtr, &i);
-		i1 = (i != 0);
-#else /* !TCL_WIDE_INT_IS_LONG */
 		GET_WIDE_OR_INT(result, valuePtr, i, w);
 		if (valuePtr->typePtr == &tclIntType) {
 		    i1 = (i != 0);
 		} else {
 		    i1 = (w != W0);
 		}
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    } else {
 		result = Tcl_GetBooleanFromObj((Tcl_Interp *) NULL,
 					       valuePtr, &i1);
@@ -2183,27 +2143,20 @@
 		
 	if ((t2Ptr == &tclIntType) || (t2Ptr == &tclBooleanType)) {
 	    i2 = (value2Ptr->internalRep.longValue != 0);
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (t2Ptr == &tclWideIntType) {
-	    i2 = (value2Ptr->internalRep.wideValue != W0);
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w,value2Ptr);
+	    i2 = (w != W0);
 	} else if (t2Ptr == &tclDoubleType) {
 	    i2 = (value2Ptr->internalRep.doubleValue != 0.0);
 	} else {
 	    s = Tcl_GetStringFromObj(value2Ptr, &length);
 	    if (TclLooksLikeInt(s, length)) {
-#ifdef TCL_WIDE_INT_IS_LONG
-		result = Tcl_GetLongFromObj((Tcl_Interp *) NULL,
-					    value2Ptr, &i);
-		i2 = (i != 0);
-#else /* !TCL_WIDE_INT_IS_LONG */
 		GET_WIDE_OR_INT(result, value2Ptr, i, w);
 		if (value2Ptr->typePtr == &tclIntType) {
 		    i2 = (i != 0);
 		} else {
 		    i2 = (w != W0);
 		}
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    } else {
 		result = Tcl_GetBooleanFromObj((Tcl_Interp *) NULL, value2Ptr, &i2);
 	    }
@@ -2818,7 +2771,6 @@
 		    iResult = d1 >= d2;
 		    break;
 	    }
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if ((t1Ptr == &tclWideIntType)
 	        || (t2Ptr == &tclWideIntType)) {
 	    Tcl_WideInt w2;
@@ -2827,13 +2779,13 @@
 	     */
 	    if (t1Ptr == &tclIntType) {
 		w  = Tcl_LongAsWide(valuePtr->internalRep.longValue);
-		w2 = value2Ptr->internalRep.wideValue;
+		TclGetWide(w2,value2Ptr);
 	    } else if (t2Ptr == &tclIntType) {
-		w  = valuePtr->internalRep.wideValue;
+		TclGetWide(w,valuePtr);
 		w2 = Tcl_LongAsWide(value2Ptr->internalRep.longValue);
 	    } else {
-		w  = valuePtr->internalRep.wideValue;
-		w2 = value2Ptr->internalRep.wideValue;
+		TclGetWide(w,valuePtr);
+		TclGetWide(w2,value2Ptr);
 	    }
 	    switch (*pc) {
 	        case INST_EQ:
@@ -2855,7 +2807,6 @@
 		    iResult = w >= w2;
 		    break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	} else {
 	    /*
 	     * Compare as ints.
@@ -2922,19 +2873,15 @@
 
 	long i2 = 0, rem, negative;
 	long iResult = 0; /* Init. avoids compiler warning. */
-#ifndef TCL_WIDE_INT_IS_LONG
 	Tcl_WideInt w2, wResult = W0;
 	int doWide = 0;
-#endif /* TCL_WIDE_INT_IS_LONG */
 
 	value2Ptr = stackPtr[stackTop];
 	valuePtr  = stackPtr[stackTop - 1]; 
 	if (valuePtr->typePtr == &tclIntType) {
 	    i = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (valuePtr->typePtr == &tclWideIntType) {
-	    w = valuePtr->internalRep.wideValue;
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w,valuePtr);
 	} else {	/* try to convert to int */
 	    REQUIRE_WIDE_OR_INT(result, valuePtr, i, w);
 	    if (result != TCL_OK) {
@@ -2948,10 +2895,8 @@
 	}
 	if (value2Ptr->typePtr == &tclIntType) {
 	    i2 = value2Ptr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (value2Ptr->typePtr == &tclWideIntType) {
-	    w2 = value2Ptr->internalRep.wideValue;
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w2,value2Ptr);
 	} else {
 	    REQUIRE_WIDE_OR_INT(result, value2Ptr, i2, w2);
 	    if (result != TCL_OK) {
@@ -2972,17 +2917,11 @@
 	     * remainder always has the same sign as the divisor and
 	     * a smaller absolute value.
 	     */
-#ifdef TCL_WIDE_INT_IS_LONG
-	    if (i2 == 0) {
-		TRACE(("%ld %ld => DIVIDE BY ZERO\n", i, i2));
-		goto divideByZero;
-	    }
-#else /* !TCL_WIDE_INT_IS_LONG */
 	    if (value2Ptr->typePtr == &tclWideIntType && w2 == W0) {
 		if (valuePtr->typePtr == &tclIntType) {
-		    LLTRACE(("%ld "LLD" => DIVIDE BY ZERO\n", i, w2));
+		    TRACE(("%ld "LLD" => DIVIDE BY ZERO\n", i, w2));
 		} else {
-		    LLTRACE((LLD" "LLD" => DIVIDE BY ZERO\n", w, w2));
+		    TRACE((LLD" "LLD" => DIVIDE BY ZERO\n", w, w2));
 		}
 		goto divideByZero;
 	    }
@@ -2990,13 +2929,11 @@
 		if (valuePtr->typePtr == &tclIntType) {
 		    TRACE(("%ld %ld => DIVIDE BY ZERO\n", i, i2));
 		} else {
-		    LLTRACE((LLD" %ld => DIVIDE BY ZERO\n", w, i2));
+		    TRACE((LLD" %ld => DIVIDE BY ZERO\n", w, i2));
 		}
 		goto divideByZero;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    negative = 0;
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (valuePtr->typePtr == &tclWideIntType
 		|| value2Ptr->typePtr == &tclWideIntType) {
 		Tcl_WideInt wRemainder;
@@ -3024,7 +2961,6 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    if (i2 < 0) {
 		i2 = -i2;
 		i = -i;
@@ -3040,7 +2976,6 @@
 	    iResult = rem;
 	    break;
 	case INST_LSHIFT:
-#ifndef TCL_WIDE_INT_IS_LONG
 	    /*
 	     * Shifts are never usefully 64-bits wide!
 	     */
@@ -3053,7 +2988,6 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    iResult = i << i2;
 	    break;
 	case INST_RSHIFT:
@@ -3062,7 +2996,6 @@
 	     * right shifts propagate the sign bit even on machines
 	     * where ">>" won't do it by default.
 	     */
-#ifndef TCL_WIDE_INT_IS_LONG
 	    /*
 	     * Shifts are never usefully 64-bits wide!
 	     */
@@ -3079,7 +3012,6 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    if (i < 0) {
 		iResult = ~((~i) >> i2);
 	    } else {
@@ -3087,7 +3019,6 @@
 	    }
 	    break;
 	case INST_BITOR:
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (valuePtr->typePtr == &tclWideIntType
 		|| value2Ptr->typePtr == &tclWideIntType) {
 		/*
@@ -3102,11 +3033,9 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    iResult = i | i2;
 	    break;
 	case INST_BITXOR:
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (valuePtr->typePtr == &tclWideIntType
 		|| value2Ptr->typePtr == &tclWideIntType) {
 		/*
@@ -3121,11 +3050,9 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    iResult = i ^ i2;
 	    break;
 	case INST_BITAND:
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (valuePtr->typePtr == &tclWideIntType
 		|| value2Ptr->typePtr == &tclWideIntType) {
 		/*
@@ -3140,7 +3067,6 @@
 		doWide = 1;
 		break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    iResult = i & i2;
 	    break;
 	}
@@ -3150,30 +3076,22 @@
 	 */
 		
 	if (Tcl_IsShared(valuePtr)) {
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (doWide) {
 		objResultPtr = Tcl_NewWideIntObj(wResult);
-		LLTRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
+		TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
 	    } else {
-#endif /* TCL_WIDE_INT_IS_LONG */
 		objResultPtr = Tcl_NewLongObj(iResult);
 		TRACE(("%ld %ld => %ld\n", i, i2, iResult));
-#ifndef TCL_WIDE_INT_IS_LONG
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    NEXT_INST_F(1, 2, 1);
 	} else {	/* reuse the valuePtr object */
-#ifndef TCL_WIDE_INT_IS_LONG
 	    if (doWide) {
-		LLTRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
+		TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
 		Tcl_SetWideIntObj(valuePtr, wResult);
 	    } else {
-#endif /* TCL_WIDE_INT_IS_LONG */
 		TRACE(("%ld %ld => %ld\n", i, i2, iResult));
 		Tcl_SetLongObj(valuePtr, iResult);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    NEXT_INST_F(1, 1, 0);
 	}
     }
@@ -3194,11 +3112,9 @@
 	long iResult = 0;	/* Init. avoids compiler warning. */
 	double dResult = 0.0;	/* Init. avoids compiler warning. */
 	int doDouble = 0;	/* 1 if doing floating arithmetic */
-#ifndef TCL_WIDE_INT_IS_LONG
 	Tcl_WideInt w2, wquot, wrem;
 	Tcl_WideInt wResult = W0; /* Init. avoids compiler warning. */
 	int doWide = 0;		/* 1 if doing wide arithmetic. */
-#endif /* TCL_WIDE_INT_IS_LONG */
 
 	value2Ptr = stackPtr[stackTop];
 	valuePtr  = stackPtr[stackTop - 1];
@@ -3207,10 +3123,8 @@
 		
 	if (t1Ptr == &tclIntType) {
 	    i = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (t1Ptr == &tclWideIntType) {
-	    w = valuePtr->internalRep.wideValue;
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w,valuePtr);
 	} else if ((t1Ptr == &tclDoubleType)
 		   && (valuePtr->bytes == NULL)) {
 	    /*
@@ -3241,10 +3155,8 @@
 
 	if (t2Ptr == &tclIntType) {
 	    i2 = value2Ptr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (t2Ptr == &tclWideIntType) {
-	    w2 = value2Ptr->internalRep.wideValue;
-#endif /* TCL_WIDE_INT_IS_LONG */
+	    TclGetWide(w2,value2Ptr);
 	} else if ((t2Ptr == &tclDoubleType)
 		   && (value2Ptr->bytes == NULL)) {
 	    /*
@@ -3282,12 +3194,10 @@
 		d1 = i;       /* promote value 1 to double */
 	    } else if (t2Ptr == &tclIntType) {
 		d2 = i2;      /* promote value 2 to double */
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (t1Ptr == &tclWideIntType) {
 		d1 = Tcl_WideAsDouble(w);
 	    } else if (t2Ptr == &tclWideIntType) {
 		d2 = Tcl_WideAsDouble(w2);
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    }
 	    switch (*pc) {
 	        case INST_ADD:
@@ -3319,7 +3229,6 @@
 		result = TCL_ERROR;
 		goto checkForCatch;
 	    }
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if ((t1Ptr == &tclWideIntType) 
 		   || (t2Ptr == &tclWideIntType)) {
 	    /*
@@ -3349,7 +3258,7 @@
 		     * divisor and a smaller absolute value.
 		     */
 		    if (w2 == W0) {
-			LLTRACE((LLD" "LLD" => DIVIDE BY ZERO\n", w, w2));
+			TRACE((LLD" "LLD" => DIVIDE BY ZERO\n", w, w2));
 			goto divideByZero;
 		    }
 		    if (w2 < 0) {
@@ -3364,7 +3273,6 @@
 		    wResult = wquot;
 		    break;
 	    }
-#endif /* TCL_WIDE_INT_IS_LONG */
 	} else {
 	    /*
 		     * Do integer arithmetic.
@@ -3412,11 +3320,9 @@
 	    if (doDouble) {
 		objResultPtr = Tcl_NewDoubleObj(dResult);
 		TRACE(("%.6g %.6g => %.6g\n", d1, d2, dResult));
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (doWide) {
 		objResultPtr = Tcl_NewWideIntObj(wResult);
-		LLTRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
-#endif /* TCL_WIDE_INT_IS_LONG */
+		TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
 	    } else {
 		objResultPtr = Tcl_NewLongObj(iResult);
 		TRACE(("%ld %ld => %ld\n", i, i2, iResult));
@@ -3426,11 +3332,9 @@
 	    if (doDouble) { /* NB: stack top is off by 1 */
 		TRACE(("%.6g %.6g => %.6g\n", d1, d2, dResult));
 		Tcl_SetDoubleObj(valuePtr, dResult);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (doWide) {
-		LLTRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
+		TRACE((LLD" "LLD" => "LLD"\n", w, w2, wResult));
 		Tcl_SetWideIntObj(valuePtr, wResult);
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    } else {
 		TRACE(("%ld %ld => %ld\n", i, i2, iResult));
 		Tcl_SetLongObj(valuePtr, iResult);
@@ -3480,11 +3384,9 @@
 	    if (tPtr == &tclIntType) {
 		i = valuePtr->internalRep.longValue;
 		objResultPtr = Tcl_NewLongObj(i);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (tPtr == &tclWideIntType) {
-		w = valuePtr->internalRep.wideValue;
+		TclGetWide(w,valuePtr);
 		objResultPtr = Tcl_NewWideIntObj(w);
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    } else {
 		d = valuePtr->internalRep.doubleValue;
 		objResultPtr = Tcl_NewDoubleObj(d);
@@ -3552,16 +3454,14 @@
 		objResultPtr = Tcl_NewLongObj(
 		    (*pc == INST_UMINUS)? -i : !i);
 		TRACE_WITH_OBJ(("%ld => ", i), objResultPtr);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (tPtr == &tclWideIntType) {
-		w = valuePtr->internalRep.wideValue;
+		TclGetWide(w,valuePtr);
 		if (*pc == INST_UMINUS) {
 		    objResultPtr = Tcl_NewWideIntObj(-w);
 		} else {
 		    objResultPtr = Tcl_NewLongObj(w == W0);
 		}
-		LLTRACE_WITH_OBJ((LLD" => ", w), objResultPtr);
-#endif /* TCL_WIDE_INT_IS_LONG */
+		TRACE_WITH_OBJ((LLD" => ", w), objResultPtr);
 	    } else {
 		d = valuePtr->internalRep.doubleValue;
 		if (*pc == INST_UMINUS) {
@@ -3585,16 +3485,14 @@
 		Tcl_SetLongObj(valuePtr,
 	                (*pc == INST_UMINUS)? -i : !i);
 		TRACE_WITH_OBJ(("%ld => ", i), valuePtr);
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (tPtr == &tclWideIntType) {
-		w = valuePtr->internalRep.wideValue;
+		TclGetWide(w,valuePtr);
 		if (*pc == INST_UMINUS) {
 		    Tcl_SetWideIntObj(valuePtr, -w);
 		} else {
 		    Tcl_SetLongObj(valuePtr, w == W0);
 		}
-		LLTRACE_WITH_OBJ((LLD" => ", w), valuePtr);
-#endif /* TCL_WIDE_INT_IS_LONG */
+		TRACE_WITH_OBJ((LLD" => ", w), valuePtr);
 	    } else {
 		d = valuePtr->internalRep.doubleValue;
 		if (*pc == INST_UMINUS) {
@@ -3635,23 +3533,21 @@
 	    }
 	}
 		
-#ifndef TCL_WIDE_INT_IS_LONG
 	if (valuePtr->typePtr == &tclWideIntType) {
-	    w = valuePtr->internalRep.wideValue;
+	    TclGetWide(w,valuePtr);
 	    if (Tcl_IsShared(valuePtr)) {
 		objResultPtr = Tcl_NewWideIntObj(~w);
-		LLTRACE(("0x%llx => (%llu)\n", w, ~w));
+		TRACE(("0x%llx => (%llu)\n", w, ~w));
 		NEXT_INST_F(1, 1, 1);
 	    } else {
 		/*
 		 * valuePtr is unshared. Modify it directly.
 		 */
 		Tcl_SetWideIntObj(valuePtr, ~w);
-		LLTRACE(("0x%llx => (%llu)\n", w, ~w));
+		TRACE(("0x%llx => (%llu)\n", w, ~w));
 		NEXT_INST_F(1, 0, 0);
 	    }
 	} else {
-#endif /* TCL_WIDE_INT_IS_LONG */
 	    i = valuePtr->internalRep.longValue;
 	    if (Tcl_IsShared(valuePtr)) {
 		objResultPtr = Tcl_NewLongObj(~i);
@@ -3665,9 +3561,7 @@
 		TRACE(("0x%lx => (%lu)\n", i, ~i));
 		NEXT_INST_F(1, 0, 0);
 	    }
-#ifndef TCL_WIDE_INT_IS_LONG
 	}
-#endif /* TCL_WIDE_INT_IS_LONG */
     }
 
     case INST_CALL_BUILTIN_FUNC1:
@@ -3781,11 +3675,9 @@
 		    if (tPtr == &tclIntType) {
 			i = valuePtr->internalRep.longValue;
 			objResultPtr = Tcl_NewLongObj(i);
-#ifndef TCL_WIDE_INT_IS_LONG
 		    } else if (tPtr == &tclWideIntType) {
-			w = valuePtr->internalRep.wideValue;
+			TclGetWide(w,valuePtr);
 			objResultPtr = Tcl_NewWideIntObj(w);
-#endif /* TCL_WIDE_INT_IS_LONG */
 		    } else {
 			d = valuePtr->internalRep.doubleValue;
 			objResultPtr = Tcl_NewDoubleObj(d);
@@ -4753,13 +4645,8 @@
 	char *s = Tcl_GetStringFromObj(objPtr, &length);
 	
 	if (TclLooksLikeInt(s, length)) {
-#ifdef TCL_WIDE_INT_IS_LONG
-	    long i;
-	    result = Tcl_GetLongFromObj((Tcl_Interp *) NULL, objPtr, &i);
-#else /* !TCL_WIDE_INT_IS_LONG */
 	    Tcl_WideInt w;
 	    result = Tcl_GetWideIntFromObj((Tcl_Interp *) NULL, objPtr, &w);
-#endif /* TCL_WIDE_INT_IS_LONG */
 	} else {
 	    double d;
 	    result = Tcl_GetDoubleFromObj((Tcl_Interp *) NULL, objPtr, &d);
@@ -4984,9 +4871,9 @@
 	    iResult = i;
 	}	    
 	PUSH_OBJECT(Tcl_NewLongObj(iResult));
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (valuePtr->typePtr == &tclWideIntType) {
-	Tcl_WideInt wResult, w = valuePtr->internalRep.wideValue;
+	Tcl_WideInt wResult, w;
+	TclGetWide(w,valuePtr);
 	if (w < W0) {
 	    wResult = -w;
 	    if (wResult < 0) {
@@ -5002,7 +4889,6 @@
 	    wResult = w;
 	}	    
 	PUSH_OBJECT(Tcl_NewWideIntObj(wResult));
-#endif /* TCL_WIDE_INT_IS_LONG */
     } else {
 	d = valuePtr->internalRep.doubleValue;
 	if (d < 0.0) {
@@ -5113,10 +4999,8 @@
     
     if (valuePtr->typePtr == &tclIntType) {
 	iResult = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (valuePtr->typePtr == &tclWideIntType) {
-	iResult = Tcl_WideAsLong(valuePtr->internalRep.wideValue);
-#endif /* TCL_WIDE_INT_IS_LONG */
+	TclGetLongFromWide(iResult,valuePtr);
     } else {
 	d = valuePtr->internalRep.doubleValue;
 	if (d < 0.0) {
@@ -5159,7 +5043,6 @@
     return result;
 }
 
-#ifndef TCL_WIDE_INT_IS_LONG
 static int
 ExprWideFunc(interp, eePtr, clientData)
     Tcl_Interp *interp;		/* The interpreter in which to execute the
@@ -5194,7 +5077,7 @@
     }
     
     if (valuePtr->typePtr == &tclWideIntType) {
-	wResult = valuePtr->internalRep.wideValue;
+	TclGetWide(wResult,valuePtr);
     } else if (valuePtr->typePtr == &tclIntType) {
 	wResult = Tcl_LongAsWide(valuePtr->internalRep.longValue);
     } else {
@@ -5238,7 +5121,6 @@
     DECACHE_STACK_INFO();
     return result;
 }
-#endif /* TCL_WIDE_INT_IS_LONG */
 
 static int
 ExprRandFunc(interp, eePtr, clientData)
@@ -5376,11 +5258,11 @@
     
     if (valuePtr->typePtr == &tclIntType) {
 	iResult = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (valuePtr->typePtr == &tclWideIntType) {
-	PUSH_OBJECT(Tcl_NewWideIntObj(valuePtr->internalRep.wideValue));
+	Tcl_WideInt w;
+	TclGetWide(w,valuePtr);
+	PUSH_OBJECT(Tcl_NewWideIntObj(w));
 	goto done;
-#endif /* TCL_WIDE_INT_IS_LONG */
     } else {
 	d = valuePtr->internalRep.doubleValue;
 	if (d < 0.0) {
@@ -5459,10 +5341,8 @@
 
     if (valuePtr->typePtr == &tclIntType) {
 	i = valuePtr->internalRep.longValue;
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (valuePtr->typePtr == &tclWideIntType) {
-	i = Tcl_WideAsLong(valuePtr->internalRep.wideValue);
-#endif /* TCL_WIDE_INT_IS_LONG */
+	TclGetLongFromWide(i,valuePtr);
     } else {
 	/*
 	 * At this point, the only other possible type is double
@@ -5599,39 +5479,34 @@
 	    if (mathFuncPtr->argTypes[k] == TCL_DOUBLE) {
 		args[k].type = TCL_DOUBLE;
 		args[k].doubleValue = i;
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (mathFuncPtr->argTypes[k] == TCL_WIDE_INT) {
 		args[k].type = TCL_WIDE_INT;
 		args[k].wideValue = Tcl_LongAsWide(i);
-#endif /* !TCL_WIDE_INT_IS_LONG */
 	    } else {
 		args[k].type = TCL_INT;
 		args[k].intValue = i;
 	    }
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (valuePtr->typePtr == &tclWideIntType) {
-	    Tcl_WideInt w = valuePtr->internalRep.wideValue;
+	    Tcl_WideInt w;
+	    TclGetWide(w,valuePtr);
 	    if (mathFuncPtr->argTypes[k] == TCL_DOUBLE) {
 		args[k].type = TCL_DOUBLE;
-		args[k].wideValue = (Tcl_WideInt) Tcl_WideAsDouble(w);
+		args[k].doubleValue = (Tcl_WideInt) Tcl_WideAsDouble(w);
 	    } else if (mathFuncPtr->argTypes[k] == TCL_INT) {
 		args[k].type = TCL_INT;
-		args[k].wideValue = Tcl_WideAsLong(w);
+		args[k].intValue = Tcl_WideAsLong(w);
 	    } else {
 		args[k].type = TCL_WIDE_INT;
 		args[k].wideValue = w;
 	    }
-#endif /* !TCL_WIDE_INT_IS_LONG */
 	} else {
 	    d = valuePtr->internalRep.doubleValue;
 	    if (mathFuncPtr->argTypes[k] == TCL_INT) {
 		args[k].type = TCL_INT;
 		args[k].intValue = (long) d;
-#ifndef TCL_WIDE_INT_IS_LONG
 	    } else if (mathFuncPtr->argTypes[k] == TCL_WIDE_INT) {
 		args[k].type = TCL_WIDE_INT;
 		args[k].wideValue = Tcl_DoubleAsWide(d);
-#endif /* !TCL_WIDE_INT_IS_LONG */
 	    } else {
 		args[k].type = TCL_DOUBLE;
 		args[k].doubleValue = d;
@@ -5665,10 +5540,8 @@
     
     if (funcResult.type == TCL_INT) {
 	PUSH_OBJECT(Tcl_NewLongObj(funcResult.intValue));
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (funcResult.type == TCL_WIDE_INT) {
 	PUSH_OBJECT(Tcl_NewWideIntObj(funcResult.wideValue));
-#endif /* !TCL_WIDE_INT_IS_LONG */
     } else {
 	d = funcResult.doubleValue;
 	if (IS_NAN(d) || IS_INF(d)) {
Index: generic/tclInt.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclInt.h,v
retrieving revision 1.123
diff -u -r1.123 tclInt.h
--- generic/tclInt.h	5 Apr 2003 01:41:23 -0000	1.123
+++ generic/tclInt.h	7 Apr 2003 17:20:07 -0000
@@ -1561,9 +1561,7 @@
 extern Tcl_ObjType	tclArraySearchType;
 extern Tcl_ObjType	tclIndexType;
 extern Tcl_ObjType	tclNsNameType;
-#ifndef TCL_WIDE_INT_IS_LONG
 extern Tcl_ObjType	tclWideIntType;
-#endif
 
 /*
  * Variables denoting the hash key types defined in the core.
@@ -2212,6 +2210,26 @@
 
 #define TclGetString(objPtr) \
     ((objPtr)->bytes? (objPtr)->bytes : Tcl_GetString((objPtr)))
+
+/*
+ *----------------------------------------------------------------
+ * Macro used by the Tcl core to get a Tcl_WideInt value out of
+ * a Tcl_Obj of the "wideInt" type.  Different implementation on
+ * different platforms depending whether TCL_WIDE_INT_IS_LONG.
+ *----------------------------------------------------------------
+ */
+
+#ifdef TCL_WIDE_INT_IS_LONG
+#    define TclGetWide(resultVar, objPtr) \
+	(resultVar) = (objPtr)->internalRep.longValue
+#    define TclGetLongFromWide(resultVar, objPtr) \
+	(resultVar) = (objPtr)->internalRep.longValue
+#else
+#    define TclGetWide(resultVar, objPtr) \
+	(resultVar) = (objPtr)->internalRep.wideValue
+#    define TclGetLongFromWide(resultVar, objPtr) \
+	(resultVar) = Tcl_WideAsLong((objPtr)->internalRep.wideValue)
+#endif
 
 /*
  *----------------------------------------------------------------
Index: generic/tclObj.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclObj.c,v
retrieving revision 1.44
diff -u -r1.44 tclObj.c
--- generic/tclObj.c	7 Apr 2003 10:12:10 -0000	1.44
+++ generic/tclObj.c	7 Apr 2003 17:20:07 -0000
@@ -63,9 +63,9 @@
 static void		UpdateStringOfBoolean _ANSI_ARGS_((Tcl_Obj *objPtr));
 static void		UpdateStringOfDouble _ANSI_ARGS_((Tcl_Obj *objPtr));
 static void		UpdateStringOfInt _ANSI_ARGS_((Tcl_Obj *objPtr));
-#ifndef TCL_WIDE_INT_IS_LONG
 static int		SetWideIntFromAny _ANSI_ARGS_((Tcl_Interp *interp,
 			    Tcl_Obj *objPtr));
+#ifndef TCL_WIDE_INT_IS_LONG
 static void		UpdateStringOfWideInt _ANSI_ARGS_((Tcl_Obj *objPtr));
 #endif
 
@@ -132,11 +132,10 @@
     (Tcl_DupInternalRepProc *) NULL,	/* dupIntRepProc */
 #ifdef TCL_WIDE_INT_IS_LONG
     UpdateStringOfInt,			/* updateStringProc */
-    SetIntFromAny			/* setFromAnyProc */
 #else /* !TCL_WIDE_INT_IS_LONG */
     UpdateStringOfWideInt,		/* updateStringProc */
-    SetWideIntFromAny			/* setFromAnyProc */
 #endif /* TCL_WIDE_INT_IS_LONG */
+    SetWideIntFromAny			/* setFromAnyProc */
 };
 
 /*
@@ -2137,12 +2136,12 @@
  *----------------------------------------------------------------------
  */
 
-#ifndef TCL_WIDE_INT_IS_LONG
 static int
 SetWideIntFromAny(interp, objPtr)
     Tcl_Interp *interp;		/* Used for error reporting if not NULL. */
     register Tcl_Obj *objPtr;	/* The object to convert. */
 {
+#ifndef TCL_WIDE_INT_IS_LONG
     Tcl_ObjType *oldTypePtr = objPtr->typePtr;
     char *string, *end;
     int length;
@@ -2228,10 +2227,14 @@
     }
     
     objPtr->internalRep.wideValue = newWide;
+#else 
+    if (TCL_ERROR == SetIntFromAny(interp, objPtr)) {
+	return TCL_ERROR;
+    }
+#endif
     objPtr->typePtr = &tclWideIntType;
     return TCL_OK;
 }
-#endif
 
 /*
  *----------------------------------------------------------------------
@@ -2318,9 +2321,6 @@
     register Tcl_WideInt wideValue;	/* Wide integer used to initialize
 					 * the new object. */
 {
-#ifdef TCL_WIDE_INT_IS_LONG
-    return Tcl_NewLongObj(wideValue);
-#else
     register Tcl_Obj *objPtr;
 
     TclNewObj(objPtr);
@@ -2329,7 +2329,6 @@
     objPtr->internalRep.wideValue = wideValue;
     objPtr->typePtr = &tclWideIntType;
     return objPtr;
-#endif /* TCL_WIDE_INT_IS_LONG */
 }
 #endif /* if TCL_MEM_DEBUG */
 
@@ -2379,9 +2378,6 @@
     int line;				/* Line number in the source file;
 					 * used for debugging. */
 {
-#ifdef TCL_WIDE_INT_IS_LONG
-    return Tcl_DbNewLongObj(wideValue, file, line);
-#else
     register Tcl_Obj *objPtr;
 
     TclDbNewObj(objPtr, file, line);
@@ -2390,7 +2386,6 @@
     objPtr->internalRep.wideValue = wideValue;
     objPtr->typePtr = &tclWideIntType;
     return objPtr;
-#endif
 }
 
 #else /* if not TCL_MEM_DEBUG */
@@ -2433,9 +2428,6 @@
     register Tcl_WideInt wideValue;	/* Wide integer used to initialize
 					 * the object's value. */
 {
-#ifdef TCL_WIDE_INT_IS_LONG
-    Tcl_SetLongObj(objPtr, wideValue);
-#else
     register Tcl_ObjType *oldTypePtr = objPtr->typePtr;
 
     if (Tcl_IsShared(objPtr)) {
@@ -2449,7 +2441,6 @@
     objPtr->internalRep.wideValue = wideValue;
     objPtr->typePtr = &tclWideIntType;
     Tcl_InvalidateStringRep(objPtr);
-#endif
 }
 
 /*
@@ -2479,12 +2470,6 @@
     register Tcl_Obj *objPtr;	/* Object from which to get a wide int. */
     register Tcl_WideInt *wideIntPtr; /* Place to store resulting long. */
 {
-#ifdef TCL_WIDE_INT_IS_LONG
-    /*
-     * Next line is type-safe because we only do this when long = Tcl_WideInt
-     */
-    return Tcl_GetLongFromObj(interp, objPtr, wideIntPtr);
-#else
     register int result;
 
     if (objPtr->typePtr == &tclWideIntType) {
@@ -2496,7 +2481,6 @@
 	*wideIntPtr = objPtr->internalRep.wideValue;
     }
     return result;
-#endif
 }
 
 /*
Index: generic/tclPort.h
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclPort.h,v
retrieving revision 1.6
diff -u -r1.6 tclPort.h
--- generic/tclPort.h	15 Feb 2002 14:28:49 -0000	1.6
+++ generic/tclPort.h	7 Apr 2003 17:20:07 -0000
@@ -28,12 +28,16 @@
 #   endif
 #endif
 
-#if !defined(TCL_WIDE_INT_IS_LONG) && !defined(LLONG_MIN)
-#   ifdef LLONG_BIT
-#      define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
+#if !defined(LLONG_MIN)
+#   ifdef TCL_WIDE_INT_IS_LONG
+#      define LLONG_MIN LONG_MIN
 #   else
+#      ifdef LLONG_BIT
+#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<(LLONG_BIT-1)))
+#      else
 /* Assume we're on a system with a 64-bit 'long long' type */
-#      define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<63))
+#         define LLONG_MIN ((Tcl_WideInt)(Tcl_LongAsWide(1)<<63))
+#      endif
 #   endif
 /* Assume that if LLONG_MIN is undefined, then so is LLONG_MAX */
 #   define LLONG_MAX (~LLONG_MIN)
Index: generic/tclTest.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclTest.c,v
retrieving revision 1.64
diff -u -r1.64 tclTest.c
--- generic/tclTest.c	9 Mar 2003 14:22:06 -0000	1.64
+++ generic/tclTest.c	7 Apr 2003 17:20:08 -0000
@@ -2795,14 +2795,12 @@
 
 	    resultPtr->type = TCL_DOUBLE;
 	    resultPtr->doubleValue = ((d0 > d1)? d0 : d1);
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (args[1].type == TCL_WIDE_INT) {
 	    Tcl_WideInt w0 = Tcl_LongAsWide(i0);
 	    Tcl_WideInt w1 = args[1].wideValue;
 
 	    resultPtr->type = TCL_WIDE_INT;
 	    resultPtr->wideValue = ((w0 > w1)? w0 : w1);
-#endif
 	} else {
 	    Tcl_SetResult(interp, "T3: wrong type for arg 2", TCL_STATIC);
 	    result = TCL_ERROR;
@@ -2820,18 +2818,15 @@
 
 	    resultPtr->type = TCL_DOUBLE;
 	    resultPtr->doubleValue = ((d0 > d1)? d0 : d1);
-#ifndef TCL_WIDE_INT_IS_LONG
 	} else if (args[1].type == TCL_WIDE_INT) {
 	    double d1 = Tcl_WideAsDouble(args[1].wideValue);
 
 	    resultPtr->type = TCL_DOUBLE;
 	    resultPtr->doubleValue = ((d0 > d1)? d0 : d1);
-#endif
 	} else {
 	    Tcl_SetResult(interp, "T3: wrong type for arg 2", TCL_STATIC);
 	    result = TCL_ERROR;
 	}
-#ifndef TCL_WIDE_INT_IS_LONG
     } else if (args[0].type == TCL_WIDE_INT) {
 	Tcl_WideInt w0 = args[0].wideValue;
 	
@@ -2855,7 +2850,6 @@
 	    Tcl_SetResult(interp, "T3: wrong type for arg 2", TCL_STATIC);
 	    result = TCL_ERROR;
 	}
-#endif
     } else {
 	Tcl_SetResult(interp, "T3: wrong type for arg 1", TCL_STATIC);
 	result = TCL_ERROR;
Index: generic/tclUtil.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclUtil.c,v
retrieving revision 1.36
diff -u -r1.36 tclUtil.c
--- generic/tclUtil.c	19 Nov 2002 02:34:50 -0000	1.36
+++ generic/tclUtil.c	7 Apr 2003 17:20:08 -0000
@@ -2220,9 +2220,7 @@
 {
     char *bytes;
     int offset;
-#ifndef TCL_WIDE_INT_IS_LONG
     Tcl_WideInt wideOffset;
-#endif
 
     /*
      * If the object is already an integer, use it.
@@ -2237,16 +2235,14 @@
      * If the object is already a wide-int, and it is not out of range
      * for an integer, use it. [Bug #526717]
      */
-#ifndef TCL_WIDE_INT_IS_LONG
     if (objPtr->typePtr == &tclWideIntType) {
-	Tcl_WideInt wideOffset = objPtr->internalRep.wideValue;
+	TclGetWide(wideOffset,objPtr);
 	if (wideOffset >= Tcl_LongAsWide(INT_MIN)
 	    && wideOffset <= Tcl_LongAsWide(INT_MAX)) {
 	    *indexPtr = (int) Tcl_WideAsLong(wideOffset);
 	    return TCL_OK;
 	}
     }
-#endif /* TCL_WIDE_INT_IS_LONG */
 
     if (SetEndOffsetFromAny(NULL, objPtr) == TCL_OK) {
 	/*
@@ -2256,15 +2252,6 @@
 
 	*indexPtr = endValue + objPtr->internalRep.longValue;
 
-#ifdef TCL_WIDE_INT_IS_LONG
-    } else if (Tcl_GetIntFromObj(NULL, objPtr, &offset) == TCL_OK) {
-	/*
-	 * If the object can be converted to an integer, use that.
-	 */
-
-	*indexPtr = offset;
-
-#else /* !TCL_WIDE_INT_IS_LONG */
     } else if (Tcl_GetWideIntFromObj(NULL, objPtr, &wideOffset) == TCL_OK) {
 	/*
 	 * If the object can be converted to a wide integer, use
@@ -2283,7 +2270,6 @@
 	}
 	*indexPtr = offset;
 
-#endif /* TCL_WIDE_INT_IS_LONG */
     } else {
 	/*
 	 * Report a parse error.
Index: generic/tclVar.c
===================================================================
RCS file: /cvsroot/tcl/tcl/generic/tclVar.c,v
retrieving revision 1.70
diff -u -r1.70 tclVar.c
--- generic/tclVar.c	24 Mar 2003 00:49:00 -0000	1.70
+++ generic/tclVar.c	7 Apr 2003 17:20:09 -0000
@@ -1839,17 +1839,9 @@
 	varValuePtr = Tcl_DuplicateObj(varValuePtr);
 	createdNewObj = 1;
     }
-#ifdef TCL_WIDE_INT_IS_LONG
-    if (Tcl_GetLongFromObj(interp, varValuePtr, &i) != TCL_OK) {
-	if (createdNewObj) {
-	    Tcl_DecrRefCount(varValuePtr); /* free unneeded copy */
-	}
-	return NULL;
-    }
-    Tcl_SetLongObj(varValuePtr, (i + incrAmount));
-#else
     if (varValuePtr->typePtr == &tclWideIntType) {
-	Tcl_WideInt wide = varValuePtr->internalRep.wideValue;
+	Tcl_WideInt wide;
+	TclGetWide(wide,varValuePtr);
 	Tcl_SetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
     } else if (varValuePtr->typePtr == &tclIntType) {
 	i = varValuePtr->internalRep.longValue;
@@ -1872,7 +1864,6 @@
 	    Tcl_SetWideIntObj(varValuePtr, wide + Tcl_LongAsWide(incrAmount));
 	}
     }
-#endif
 
     /*
      * Store the variable's new value and run any write traces.