SmallInteger.st
branchjv
changeset 20079 8d884971c2ed
parent 19863 513bd7237fe7
parent 19994 1d96d9406342
child 20143 c64b16f62536
--- a/SmallInteger.st	Thu Jun 30 21:11:02 2016 +0100
+++ b/SmallInteger.st	Thu Jun 30 21:12:35 2016 +0100
@@ -232,6 +232,8 @@
     unsigned INT productLow, productHi;
     int negative;
 
+    myValue = __intVal(self);
+
 #   define low16Bits(foo)  ((foo) & 0xFFFF)
 #   define hi16Bits(foo)   ((foo) >> 16)
 #   define low32Bits(foo)  ((foo) & 0xFFFFFFFFL)
@@ -253,7 +255,6 @@
 # endif
 
     if (__isSmallInteger(aNumber)) {
-	myValue = __intVal(self);
 	otherValue = __intVal(aNumber);
 
 # if defined(USE_LONGLONG_FOR_MUL)
@@ -398,18 +399,17 @@
 # endif
     } else if (__isFloatLike(aNumber)) {
 	OBJ newFloat;
-	double val = (double)__intVal(self) * __floatVal(aNumber);
+	double val = (double)myValue * __floatVal(aNumber);
 
 	__qMKFLOAT(newFloat, val);
 	RETURN ( newFloat );
     } else if (__isShortFloat(aNumber)) {
 	OBJ newFloat;
-	float val = (float)__intVal(self) * __shortFloatVal(aNumber);
+	float val = (float)myValue * __shortFloatVal(aNumber);
 
 	__qMKSFLOAT(newFloat, val);
 	RETURN ( newFloat );
     } else if (__isFractionLike(aNumber)) {
-	INT myValue = __intVal(self);
 	OBJ t = __FractionInstPtr(aNumber)->f_numerator;
 
 	if (myValue == 0) {
@@ -558,16 +558,16 @@
      * (see the message send at the bottom)
      */
 
-    INT me, t, val;
+    INT t, val;
     double dval;
+    INT myValue = __intVal(self);
 
     if (__isSmallInteger(aNumber)) {
 	val = __intVal(aNumber);
 	if (val != 0) {
-	    me = __intVal(self);
-	    t = me / val;
+	    t = myValue / val;
 # ifdef GOOD_OPTIMIZER
-	    if (me % val == 0) {
+	    if (myValue % val == 0) {
 # else
 	    /* this is stupid - all I want is to look for a remainder ...
 	       but most compilers are too stupid and generate an extra modulus
@@ -577,7 +577,7 @@
 	       Therefore I use a multiplication which is faster than a modulo
 	       on most machines. Hint to GNU people :-)
 	    */
-	    if ((t * val) == me) {
+	    if ((t * val) == myValue) {
 # endif
 		RETURN ( __mkSmallInteger(t) );
 	    }
@@ -587,7 +587,7 @@
 	    dval = __floatVal(aNumber);
 	    if (dval != 0.0) {
 		OBJ newFloat;
-		double val = (double)__intVal(self) / dval;
+		double val = (double)myValue / dval;
 
 		__qMKFLOAT(newFloat, val);
 		RETURN ( newFloat );
@@ -646,12 +646,12 @@
      * (see the message send at the bottom)
      */
 
-    INT dividend, divisor, rslt;
+    INT divisor, rslt;
+    INT dividend = __intVal(self);
 
     if (__isSmallInteger(aNumber)) {
 	divisor = __intVal(aNumber);
 	if (divisor != 0) {
-	    dividend = __intVal(self);
 	    rslt = dividend / divisor;
 	    /*
 	     * Optimized to speed up positive result
@@ -691,7 +691,6 @@
 		t = __FractionInstPtr(aNumber)->f_denominator;
 		if (__isSmallInteger(t)) {
 		    INT den = __intVal(t);
-		    INT dividend = __intVal(self);
 		    INT prod;
 #if 0 && defined(__GNUC__) // supported from GCC 5
 		    if (!__builtin_mul_overflow(myself, den, &prod)) {