*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Tue, 16 Sep 1997 00:10:53 +0200
changeset 2933 8b65cb642d91
parent 2932 427725621da0
child 2934 eef5b537406e
*** empty log message ***
LargeInt.st
LargeInteger.st
Smalltalk.st
--- a/LargeInt.st	Mon Sep 15 23:21:43 1997 +0200
+++ b/LargeInt.st	Tue Sep 16 00:10:53 1997 +0200
@@ -1154,7 +1154,7 @@
 	    ]
 	]
     ].
-    resultDigitByteArray := ByteArray new:lResult.
+    resultDigitByteArray := ByteArray uninitializedNew:lResult.
     result := self class basicNew setDigits:resultDigitByteArray.
 
     anInteger < 0 ifTrue:[
@@ -1294,9 +1294,32 @@
 	    _l--;
 	}
 
+	_l = __intVal(lResult) - __intVal(len);
+
+	/*
+	 * remaining carry
+	 */
 	while (_carry) {
 	    *resultP++ = _carry & 0xFF;
 	    _carry >>= 8;
+	    _l--;
+	}
+
+	/*
+	 * remaining zeros
+	 */
+	while (_l--) {
+	    *resultP++ = 0;
+	}
+
+	/*
+	 * need compress ?
+	 */
+	if (resultP[-1]) {
+	    /*
+	     * no
+	     */
+	    RETURN(result);
 	}
 
 	ok = true;
@@ -1318,6 +1341,10 @@
 	    resultDigitByteArray basicAt:len put:(carry bitAnd:16rFF).
 	    carry := carry bitShift:-8
 	].
+	[len < lResult] whileTrue:[
+	    len := len + 1.
+	    resultDigitByteArray basicAt:len put:0
+	]
     ].
     ^ result compressed
 !
@@ -1531,7 +1558,7 @@
 	/*
 	 * no need to normalize ?
 	 */
-	while ((index0 >= sizeof(INT)) && (resultBytes[index0]==0)) {
+	while ((index0 > sizeof(INT)) && (resultBytes[index0]==0)) {
 	    index0--;
 	}
 
@@ -1549,7 +1576,7 @@
 	self primitiveFailed
     ].
 
-    ^ Array with:result compressed with:prevRest
+    ^ Array with:(result compressed) with:prevRest
 !
 
 absFastMinus:aSmallInteger
@@ -2320,5 +2347,5 @@
 !LargeInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Attic/LargeInt.st,v 1.54 1997-09-15 20:39:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Attic/LargeInt.st,v 1.55 1997-09-15 22:10:50 cg Exp $'
 ! !
--- a/LargeInteger.st	Mon Sep 15 23:21:43 1997 +0200
+++ b/LargeInteger.st	Tue Sep 16 00:10:53 1997 +0200
@@ -1154,7 +1154,7 @@
 	    ]
 	]
     ].
-    resultDigitByteArray := ByteArray new:lResult.
+    resultDigitByteArray := ByteArray uninitializedNew:lResult.
     result := self class basicNew setDigits:resultDigitByteArray.
 
     anInteger < 0 ifTrue:[
@@ -1294,9 +1294,32 @@
 	    _l--;
 	}
 
+	_l = __intVal(lResult) - __intVal(len);
+
+	/*
+	 * remaining carry
+	 */
 	while (_carry) {
 	    *resultP++ = _carry & 0xFF;
 	    _carry >>= 8;
+	    _l--;
+	}
+
+	/*
+	 * remaining zeros
+	 */
+	while (_l--) {
+	    *resultP++ = 0;
+	}
+
+	/*
+	 * need compress ?
+	 */
+	if (resultP[-1]) {
+	    /*
+	     * no
+	     */
+	    RETURN(result);
 	}
 
 	ok = true;
@@ -1318,6 +1341,10 @@
 	    resultDigitByteArray basicAt:len put:(carry bitAnd:16rFF).
 	    carry := carry bitShift:-8
 	].
+	[len < lResult] whileTrue:[
+	    len := len + 1.
+	    resultDigitByteArray basicAt:len put:0
+	]
     ].
     ^ result compressed
 !
@@ -1531,7 +1558,7 @@
 	/*
 	 * no need to normalize ?
 	 */
-	while ((index0 >= sizeof(INT)) && (resultBytes[index0]==0)) {
+	while ((index0 > sizeof(INT)) && (resultBytes[index0]==0)) {
 	    index0--;
 	}
 
@@ -1549,7 +1576,7 @@
 	self primitiveFailed
     ].
 
-    ^ Array with:result compressed with:prevRest
+    ^ Array with:(result compressed) with:prevRest
 !
 
 absFastMinus:aSmallInteger
@@ -2320,5 +2347,5 @@
 !LargeInteger class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.54 1997-09-15 20:39:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/LargeInteger.st,v 1.55 1997-09-15 22:10:50 cg Exp $'
 ! !
--- a/Smalltalk.st	Mon Sep 15 23:21:43 1997 +0200
+++ b/Smalltalk.st	Tue Sep 16 00:10:53 1997 +0200
@@ -2595,19 +2595,20 @@
 
     "credits for this method go to Markus ...."
 
-    |fn|
+    |fn nameString|
 
     fn := aFileNameOrString asFilename.
+    nameString := fn name.
     fn isAbsolute ifTrue:[
         "dont use path for absolute file names"
 
-        ^ fn name
+        ^ nameString
     ].
 
     self realSystemPath do:[:dirName |
         |realName|
 
-        realName := dirName asFilename construct:(fn name).
+        realName := dirName asFilename construct:nameString.
 	"/
 	"/ here, we also return true if its a directory
 	"/ (Even if unreadable). 
@@ -3776,5 +3777,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.252 1997-09-15 20:51:53 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.253 1997-09-15 22:10:53 cg Exp $'
 ! !