LargeInteger.st
branchjv
changeset 19127 940613fe6659
parent 19104 e7c5169d9ab7
parent 19126 98adb7dc1950
child 19137 199b5e15b1da
--- a/LargeInteger.st	Tue Jan 26 14:56:53 2016 +0000
+++ b/LargeInteger.st	Thu Jan 28 14:59:07 2016 +0000
@@ -2775,22 +2775,22 @@
      shift "{ Class: SmallInteger }" |
 
     anInteger == 0 ifTrue:[
-	^ ZeroDivide raiseRequestWith:thisContext
+        ^ ZeroDivide raiseRequestWith:thisContext
     ].
 
     self = anInteger ifTrue:[
-	^ Array with:1 with:0
+        ^ Array with:1 with:0
     ].
 
     shift := self highBit - anInteger highBit.
     dividend := self class digitBytes:digitByteArray copy. "/ self simpleDeepCopy sign:1.
     shift < 0 ifTrue:[
-	^ Array with:0 with:dividend compressed.
+        ^ Array with:0 with:dividend compressed.
     ].
     shift == 0 ifTrue:[
-	divisor := self class digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy.
+        divisor := self class digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy.
     ] ifFalse:[
-	divisor := anInteger bitShift:shift.
+        divisor := anInteger bitShift:shift.
     ].
 
     quo := self class basicNew numberOfDigits:((shift // 8) + 1).
@@ -2798,14 +2798,14 @@
 
     shift := shift + 1.
     [shift > 0] whileTrue:[
-	(dividend absLess:divisor) ifFalse:[
-	    digits bitSetAt:shift.
-	    (dividend absSubtract: divisor) ifFalse:[ "result == 0"
-		^ Array with:quo compressed with:dividend compressed
-	    ].
-	].
-	shift := shift - 1.
-	divisor div2.
+        (dividend absLess:divisor) ifFalse:[
+            digits bitSetAt:shift.
+            (dividend absSubtract: divisor) ifFalse:[ "result == 0"
+                ^ Array with:quo compressed with:0
+            ].
+        ].
+        shift := shift - 1.
+        divisor div2.
     ].
     ^ Array with:quo compressed with:dividend compressed
 
@@ -2814,6 +2814,7 @@
      Time millisecondsToRun:[ 10000 timesRepeat:[  16000000000 absDivMod:3000000000] ]
      16000000000 absDivMod:4000000000
      16000000000 absDivMod:3000000000
+     160000000000000000000000 absDivMod:160000000000000000000000
     "
 
     "Modified: / 5.11.1996 / 18:40:24 / cg"
@@ -4100,34 +4101,34 @@
      shift "{ Class: SmallInteger }" |
 
     anInteger == 0 ifTrue:[
-	^ ZeroDivide raiseRequestWith:thisContext
+        ^ ZeroDivide raiseRequestWith:thisContext
     ].
 
     self = anInteger ifTrue:[
-	^ 0
+        ^ 0
     ].
 
     shift := self highBit - anInteger highBit.
     dividend := self class digitBytes:digitByteArray copy. "/ self simpleDeepCopy sign:1.
     shift < 0 ifTrue:[
-	^ dividend compressed.
+        ^ dividend compressed.
     ].
     shift == 0 ifTrue:[
-	divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy
+        divisor := LargeInteger digitBytes:(anInteger digitBytes copy). "/ anInteger simpleDeepCopy
     ] ifFalse:[
-	divisor := anInteger bitShift:shift.
+        divisor := anInteger bitShift:shift.
     ].
 
 
     shift := shift + 1.
     [shift > 0] whileTrue:[
-	(dividend absLess:divisor) ifFalse:[
-	    (dividend absSubtract: divisor) ifFalse:[ "result == 0"
-		^ dividend compressed
-	    ].
-	].
-	shift := shift - 1.
-	divisor div2.
+        (dividend absLess:divisor) ifFalse:[
+            (dividend absSubtract: divisor) ifFalse:[ "result == 0"
+                ^ 0
+            ].
+        ].
+        shift := shift - 1.
+        divisor div2.
     ].
 
     ^ dividend compressed
@@ -4137,6 +4138,7 @@
 Time millisecondsToRun:[   10000 timesRepeat:[  16000000001 absDivMod:4000000001] ]
      16000000000 absMod:4000000000
      16000000000 absMod:3000000000
+     16000000000000000000 absMod:16000000000000000000
     "
 
     "Modified: / 5.11.1996 / 18:40:24 / cg"