--- a/RegressionTests__IntegerTest.st Fri May 23 17:18:08 2014 +0200
+++ b/RegressionTests__IntegerTest.st Tue Jun 03 08:55:08 2014 +0200
@@ -16,10 +16,10 @@
^ arg * 0
"
- (self doMul0_a:0) == 0
- (self doMul0_a:1) == 0
- (self doMul0_a:SmallInteger maxVal) == 0
- (self doMul0_a:SmallInteger minVal) == 0
+ (self doMul0_a:0) == 0
+ (self doMul0_a:1) == 0
+ (self doMul0_a:SmallInteger maxVal) == 0
+ (self doMul0_a:SmallInteger minVal) == 0
"
"Created: / 9.6.1999 / 15:50:48 / cg"
@@ -29,10 +29,10 @@
^ arg * 1
"
- (self doMul1_a:0) == 0
- (self doMul1_a:1) == 1
- (self doMul1_a:SmallInteger maxVal) == SmallInteger maxVal
- (self doMul1_a:SmallInteger minVal) == SmallInteger minVal
+ (self doMul1_a:0) == 0
+ (self doMul1_a:1) == 1
+ (self doMul1_a:SmallInteger maxVal) == SmallInteger maxVal
+ (self doMul1_a:SmallInteger minVal) == SmallInteger minVal
"
"Created: / 9.6.1999 / 15:49:09 / cg"
@@ -42,10 +42,10 @@
^ arg * 2
"
- (self doMul2_a:0) == 0
- (self doMul2_a:1) == 2
- (self doMul2_a:SmallInteger maxVal) = (SmallInteger maxVal + SmallInteger maxVal)
- (self doMul2_a:SmallInteger minVal) = (SmallInteger minVal + SmallInteger minVal)
+ (self doMul2_a:0) == 0
+ (self doMul2_a:1) == 2
+ (self doMul2_a:SmallInteger maxVal) = (SmallInteger maxVal + SmallInteger maxVal)
+ (self doMul2_a:SmallInteger minVal) = (SmallInteger minVal + SmallInteger minVal)
"
"Modified: / 9.6.1999 / 16:57:20 / cg"
@@ -55,12 +55,12 @@
^ arg * 3
"
- (self doMul3_a:0) == 0
- (self doMul3_a:1) == 3
- (self doMul3_a:-1) == -3
- (self doMul3_a:10000) == 30000
- (self doMul3_a:SmallInteger maxVal) = (SmallInteger maxVal + SmallInteger maxVal + SmallInteger maxVal)
- (self doMul3_a:SmallInteger minVal) = (SmallInteger minVal + SmallInteger minVal + SmallInteger minVal)
+ (self doMul3_a:0) == 0
+ (self doMul3_a:1) == 3
+ (self doMul3_a:-1) == -3
+ (self doMul3_a:10000) == 30000
+ (self doMul3_a:SmallInteger maxVal) = (SmallInteger maxVal + SmallInteger maxVal + SmallInteger maxVal)
+ (self doMul3_a:SmallInteger minVal) = (SmallInteger minVal + SmallInteger minVal + SmallInteger minVal)
"
"Created: / 9.6.1999 / 16:57:47 / cg"
@@ -71,12 +71,12 @@
^ arg * 4
"
- (self doMul4_a:0) == 0
- (self doMul4_a:1) == 4
- (self doMul4_a:-1) == -4
- (self doMul4_a:10000) == 40000
- (self doMul4_a:SmallInteger maxVal//4) == 4611686018427387900
- (self doMul4_a:SmallInteger maxVal//4+1) = 4611686018427387904
+ (self doMul4_a:0) == 0
+ (self doMul4_a:1) == 4
+ (self doMul4_a:-1) == -4
+ (self doMul4_a:10000) == 40000
+ (self doMul4_a:SmallInteger maxVal//4) == 4611686018427387900
+ (self doMul4_a:SmallInteger maxVal//4+1) = 4611686018427387904
"
"Created: / 9.6.1999 / 16:57:47 / cg"
@@ -87,12 +87,12 @@
^ arg * 5
"
- (self doMul5_a:0) == 0
- (self doMul5_a:1) == 5
- (self doMul5_a:-1) == -5
- (self doMul5_a:10000) == 50000
- (self doMul5_a:SmallInteger maxVal//5) == 4611686018427387900
- (self doMul5_a:SmallInteger maxVal//4+1) = 4611686018427387905
+ (self doMul5_a:0) == 0
+ (self doMul5_a:1) == 5
+ (self doMul5_a:-1) == -5
+ (self doMul5_a:10000) == 50000
+ (self doMul5_a:SmallInteger maxVal//5) == 4611686018427387900
+ (self doMul5_a:SmallInteger maxVal//4+1) = 4611686018427387905
"
"Created: / 9.6.1999 / 17:38:17 / cg"
@@ -102,10 +102,10 @@
^ arg * -1
"
- (self doMulM1_a:0) == 0
- (self doMulM1_a:1) == -1
- (self doMulM1_a:SmallInteger maxVal) == (SmallInteger minVal + 1)
- (self doMulM1_a:SmallInteger minVal) = (SmallInteger maxVal + 1)
+ (self doMulM1_a:0) == 0
+ (self doMulM1_a:1) == -1
+ (self doMulM1_a:SmallInteger maxVal) == (SmallInteger minVal + 1)
+ (self doMulM1_a:SmallInteger minVal) = (SmallInteger maxVal + 1)
"
"Modified: / 9.6.1999 / 16:54:02 / cg"
@@ -115,7 +115,7 @@
^ arg + 1
"
- (self doPlus1_a:SmallInteger maxVal) = 1073741824
+ (self doPlus1_a:SmallInteger maxVal) = 1073741824
"
!
@@ -123,7 +123,7 @@
^ arg perform:#+ with:1
"
- (self doPlus1_b:SmallInteger maxVal) == 1073741824
+ (self doPlus1_b:SmallInteger maxVal) == 1073741824
"
!
@@ -220,7 +220,7 @@
self assert: ( (self doMulM1_a:SmallInteger minVal) = (SmallInteger maxVal + 1) ).
"
- self basicNew testMulM1
+ self basicNew testMulM1
"
!
@@ -229,11 +229,11 @@
self assert: ( (self doPlus1_a:1) = 2 ).
self assert: ( (self doPlus1_a:-1) = 0 ).
ExternalAddress pointerSize == 8 ifTrue:[
- self assert: ( (self doPlus1_a:SmallInteger maxVal) = 4611686018427387904).
- self assert: ( (self doPlus1_a:SmallInteger minVal) = -4611686018427387903 ).
+ self assert: ( (self doPlus1_a:SmallInteger maxVal) = 4611686018427387904).
+ self assert: ( (self doPlus1_a:SmallInteger minVal) = -4611686018427387903 ).
] ifFalse:[
- self assert: ( (self doPlus1_a:SmallInteger maxVal) = 1073741824).
- self assert: ( (self doPlus1_a:SmallInteger minVal) = -1073741823 ).
+ self assert: ( (self doPlus1_a:SmallInteger maxVal) = 1073741824).
+ self assert: ( (self doPlus1_a:SmallInteger minVal) = -1073741823 ).
].
"
@@ -246,11 +246,11 @@
self assert: ( (self doPlus1_b:1) = 2 ).
self assert: ( (self doPlus1_b:-1) = 0 ).
ExternalAddress pointerSize == 8 ifTrue:[
- self assert: ( (self doPlus1_b:SmallInteger maxVal) = 4611686018427387904).
- self assert: ( (self doPlus1_b:SmallInteger minVal) = -4611686018427387903 ).
+ self assert: ( (self doPlus1_b:SmallInteger maxVal) = 4611686018427387904).
+ self assert: ( (self doPlus1_b:SmallInteger minVal) = -4611686018427387903 ).
] ifFalse:[
- self assert: ( (self doPlus1_b:SmallInteger maxVal) = 1073741824).
- self assert: ( (self doPlus1_b:SmallInteger minVal) = -1073741823 ).
+ self assert: ( (self doPlus1_b:SmallInteger maxVal) = 1073741824).
+ self assert: ( (self doPlus1_b:SmallInteger minVal) = -1073741823 ).
].
"
@@ -261,15 +261,15 @@
!IntegerTest methodsFor:'private'!
absPlusOneOf:arg
- |local1|
-
- local1 := arg.
- ^ local1 abs + 1
+ |local1|
+
+ local1 := arg.
+ ^ local1 abs + 1
"
- self absPlusOneOf:-1
- self absPlusOneOf:-1.0
+ self absPlusOneOf:-1
+ self absPlusOneOf:-1.0
"
"Created: / 31.10.2000 / 20:21:52 / cg"
@@ -1206,28 +1206,28 @@
self assert:(SmallInteger perform:'maxBytes' asSymbol) == (ExternalAddress perform:'pointerSize' asSymbol).
SmallInteger maxBytes == 4 ifTrue:[
- self assert:(minVal hexPrintString = '-40000000').
- self assert:(maxVal hexPrintString = '3FFFFFFF').
- self assert:(minVal == -1073741824).
- self assert:(maxVal == 1073741823).
- maxValPlus1 := 1073741824.
- minValMinus1 := -1073741825.
- self assert:(minValMinus1 hexPrintString = '-40000001').
- self assert:(maxValPlus1 hexPrintString = '40000000').
- halfMin := -16r20000000.
- halfMax := 16r20000000.
+ self assert:(minVal hexPrintString = '-40000000').
+ self assert:(maxVal hexPrintString = '3FFFFFFF').
+ self assert:(minVal == -1073741824).
+ self assert:(maxVal == 1073741823).
+ maxValPlus1 := 1073741824.
+ minValMinus1 := -1073741825.
+ self assert:(minValMinus1 hexPrintString = '-40000001').
+ self assert:(maxValPlus1 hexPrintString = '40000000').
+ halfMin := -16r20000000.
+ halfMax := 16r20000000.
].
SmallInteger maxBytes == 8 ifTrue:[
- self assert:(minVal hexPrintString = '-4000000000000000').
- self assert:(maxVal hexPrintString = '3FFFFFFFFFFFFFFF').
- self assert:(minVal == -4611686018427387904).
- self assert:(maxVal == 4611686018427387903).
- maxValPlus1 := 4611686018427387904.
- minValMinus1 := -4611686018427387905.
- self assert:(minValMinus1 hexPrintString = '-4000000000000001').
- self assert:(maxValPlus1 hexPrintString = '4000000000000000').
- halfMin := -16r2000000000000000.
- halfMax := 16r2000000000000000.
+ self assert:(minVal hexPrintString = '-4000000000000000').
+ self assert:(maxVal hexPrintString = '3FFFFFFFFFFFFFFF').
+ self assert:(minVal == -4611686018427387904).
+ self assert:(maxVal == 4611686018427387903).
+ maxValPlus1 := 4611686018427387904.
+ minValMinus1 := -4611686018427387905.
+ self assert:(minValMinus1 hexPrintString = '-4000000000000001').
+ self assert:(maxValPlus1 hexPrintString = '4000000000000000').
+ halfMin := -16r2000000000000000.
+ halfMax := 16r2000000000000000.
].
"arithmetic overFlow checks"
@@ -1347,13 +1347,13 @@
n := 7.
self assert:(n fib == 13).
- #(0 1 2 3 4 5 6 7)
+ #(0 1 2 3 4 5 6 7)
with:#(0 1 1 2 3 5 8 13)
do:[:n :rslt |
- self assert:(n fib == rslt).
+ self assert:(n fib == rslt).
].
-"/ #(0 1 2 3 4 5 6 7)
+"/ #(0 1 2 3 4 5 6 7)
"/ with:#(0 1 1 2 3 5 8 13)
"/ do:[:n :rslt |
"/ self assert:(n fib_recursive == rslt).
@@ -1385,14 +1385,14 @@
self assert:(
(((0 to:64) collect:[:s | 1 bitShift:s])
- collect:[:n | n highBit]) = (1 to:65)
+ collect:[:n | n highBit]) = (1 to:65)
).
1 to:10000 do:[:s |
- self assert:( (1 bitShift:s) highBit == (s+1) )
+ self assert:( (1 bitShift:s) highBit == (s+1) )
].
1 to:10000 do:[:s |
- self assert:( ((1 bitShift:s) - 1) highBit == s )
+ self assert:( ((1 bitShift:s) - 1) highBit == s )
].
"
@@ -1836,18 +1836,18 @@
self assert:(16rFFEEDDCCBBAA998877665544332211 bitOr:16rFFFFFFFFFFFFFFFFFFFFFFFF) hexPrintString = 'FFEEDDFFFFFFFFFFFFFFFFFFFFFFFF'.
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- (16rFFEEDDCCBBAA998877665544332211 bitAnd:16rFFFFFFFFFFFFFFFFFFFFFFFF)
- ]
- ].
+ 1000000 timesRepeat:[
+ (16rFFEEDDCCBBAA998877665544332211 bitAnd:16rFFFFFFFFFFFFFFFFFFFFFFFF)
+ ]
+ ].
"/ bitAnd inherited via Integer: 1638 1575 1576
- "/ bitAnd tuned in largeInteger: 172 171 172
+ "/ bitAnd tuned in largeInteger: 172 171 172
Time millisecondsToRun:[
- 1000000 timesRepeat:[
- (16rFFEEDDCCBBAA998877665544332211 bitOr:16rFFFFFFFFFFFFFFFFFFFFFFFF)
- ]
- ].
+ 1000000 timesRepeat:[
+ (16rFFEEDDCCBBAA998877665544332211 bitOr:16rFFFFFFFFFFFFFFFFFFFFFFFF)
+ ]
+ ].
"/ bitOr inherited via Integer: 1903 1856 1856
"
@@ -1861,45 +1861,45 @@
|l nullBytes|
#(
- #[ 1 ] 16r01
- #[ 1 2 ] 16r0201
- #[ 1 2 3] 16r030201
- #[ 1 2 3 4] 16r04030201
+ #[ 1 ] 16r01
+ #[ 1 2 ] 16r0201
+ #[ 1 2 3] 16r030201
+ #[ 1 2 3 4] 16r04030201
) pairWiseDo:[:bytes :expected |
- 0 to:16 do:[:nNullBytes |
- nullBytes := ByteArray new:nNullBytes withAll:0.
- l := LargeInteger digitBytes:(bytes , nullBytes).
- self assert:( l compressed == expected ).
- ].
+ 0 to:16 do:[:nNullBytes |
+ nullBytes := ByteArray new:nNullBytes withAll:0.
+ l := LargeInteger digitBytes:(bytes , nullBytes).
+ self assert:( l compressed == expected ).
+ ].
].
#(
- #[ 1 2 3 4 5] 16r0504030201
- #[ 1 2 3 4 5 6] 16r060504030201
- #[ 1 2 3 4 5 6 7] 16r07060504030201
- #[ 1 2 3 4 5 6 7 8] 16r0807060504030201
+ #[ 1 2 3 4 5] 16r0504030201
+ #[ 1 2 3 4 5 6] 16r060504030201
+ #[ 1 2 3 4 5 6 7] 16r07060504030201
+ #[ 1 2 3 4 5 6 7 8] 16r0807060504030201
) pairWiseDo:[:bytes :expected |
- 0 to:16 do:[:nNullBytes |
- nullBytes := ByteArray new:nNullBytes withAll:0.
- l := LargeInteger digitBytes:(bytes , nullBytes).
- ExternalAddress pointerSize == 8 ifTrue:[
- self assert:( l compressed == expected ).
- ] ifFalse:[
- self assert:( l compressed = expected ).
- ]
- ]
+ 0 to:16 do:[:nNullBytes |
+ nullBytes := ByteArray new:nNullBytes withAll:0.
+ l := LargeInteger digitBytes:(bytes , nullBytes).
+ ExternalAddress pointerSize == 8 ifTrue:[
+ self assert:( l compressed == expected ).
+ ] ifFalse:[
+ self assert:( l compressed = expected ).
+ ]
+ ]
].
#(
- #[ 1 2 3 4 5 6 7 8 9] 16r090807060504030201
- #[ 1 2 3 4 5 6 7 8 9 10] 16r0a090807060504030201
- #[ 1 2 3 4 5 6 7 8 9 10 11] 16r0b0a090807060504030201
+ #[ 1 2 3 4 5 6 7 8 9] 16r090807060504030201
+ #[ 1 2 3 4 5 6 7 8 9 10] 16r0a090807060504030201
+ #[ 1 2 3 4 5 6 7 8 9 10 11] 16r0b0a090807060504030201
) pairWiseDo:[:bytes :expected |
- 0 to:16 do:[:nNullBytes |
- nullBytes := ByteArray new:nNullBytes withAll:0.
- l := LargeInteger digitBytes:(bytes , nullBytes).
- self assert:( l compressed = expected ).
- ]
+ 0 to:16 do:[:nNullBytes |
+ nullBytes := ByteArray new:nNullBytes withAll:0.
+ l := LargeInteger digitBytes:(bytes , nullBytes).
+ self assert:( l compressed = expected ).
+ ]
].
"
@@ -2002,12 +2002,12 @@
self assert:(t compressed = 20 factorial).
self assert:(
- [
- |v|
- v := 100 factorial copy.
- v absSubtract:99 factorial.
- v compressed = (100 factorial - 99 factorial).
- ] value).
+ [
+ |v|
+ v := 100 factorial copy.
+ v absSubtract:99 factorial.
+ v compressed = (100 factorial - 99 factorial).
+ ] value).
"Large // Large division"
self assert:((20 factorial // 19 factorial) == 20).
@@ -2246,7 +2246,7 @@
self assert:(t2 at:1) = 12345678901234567.
self assert:(t2 at:2) = 890.
-
+
"
self basicNew testLargeIntegerHelpers
"
@@ -2264,7 +2264,7 @@
self assert:((t1 * t1) printString = '10000').
self assert:((t1 perform:'*' asSymbol with:t1) printString = '10000').
- t1 := 1000.
+ t1 := 1000.
self assert:(t1 * t1 == 1000000).
self assert:((t1 perform:'*' asSymbol with:t1) == 1000000).
self assert:((t1 * t1) printString = '1000000').
@@ -2278,12 +2278,12 @@
t1 := 100000.
SmallInteger maxBytes == 4 ifTrue:[
- self assert:(t1 * t1 = 10000000000).
- self assert:((t1 perform:'*' asSymbol with:t1) = 10000000000).
+ self assert:(t1 * t1 = 10000000000).
+ self assert:((t1 perform:'*' asSymbol with:t1) = 10000000000).
].
SmallInteger maxBytes == 8 ifTrue:[
- self assert:(t1 * t1 == 10000000000).
- self assert:((t1 perform:'*' asSymbol with:t1) == 10000000000).
+ self assert:(t1 * t1 == 10000000000).
+ self assert:((t1 perform:'*' asSymbol with:t1) == 10000000000).
].
self assert:((t1 * t1) printString = '10000000000').
@@ -2428,52 +2428,52 @@
self assert:((t1 * t1) = 489576143188809998144298426641311496989165214458056165805143410866108690058261346129614030084813851082564698610174813898740525406243367146120734370570458429364167811695064904353093506532695086211301649001517008746471464304183710723162864634442619484210170532881759249266026059786349673031239277666195699357198366128286910123306594912484590029738722281929300359929462301099981920256369394887701755497894820998573896950238852994224811101315810851671448056042419257789317787959570728520197146733902575090480065597582292177085754523686580725860228636039424698638422538988050350726807943014483010988455057592156160000).
self assert:((t1 * t1) printString = '489576143188809998144298426641311496989165214458056165805143410866108690058261346129614030084813851082564698610174813898740525406243367146120734370570458429364167811695064904353093506532695086211301649001517008746471464304183710723162864634442619484210170532881759249266026059786349673031239277666195699357198366128286910123306594912484590029738722281929300359929462301099981920256369394887701755497894820998573896950238852994224811101315810851671448056042419257789317787959570728520197146733902575090480065597582292177085754523686580725860228636039424698638422538988050350726807943014483010988455057592156160000').
- #(
- 16rFF
- 16rFFFF
- 16rFFFFFF
- 16rFFFFFFFF
- 16rFFFFFFFFFF
- 16rFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFFFFFF
+ #(
+ 16rFF
+ 16rFFFF
+ 16rFFFFFF
+ 16rFFFFFFFF
+ 16rFFFFFFFFFF
+ 16rFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFFFFFF
) do:[:eachFactor1 |
- #(
- 16rFF
- 16rFFFF
- 16rFFFFFF
- 16rFFFFFFFF
- 16rFFFFFFFFFF
- 16rFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFFFF
- 16rFFFFFFFFFFFFFFFFFFFFFFFF
- ) do:[:eachFactor2 |
- |t3|
-
- t1 := (eachFactor1 * eachFactor2).
- t2 := (eachFactor2 * eachFactor1).
-
- self assert:(t1 = t2).
+ #(
+ 16rFF
+ 16rFFFF
+ 16rFFFFFF
+ 16rFFFFFFFF
+ 16rFFFFFFFFFF
+ 16rFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFFFF
+ 16rFFFFFFFFFFFFFFFFFFFFFFFF
+ ) do:[:eachFactor2 |
+ |t3|
+
+ t1 := (eachFactor1 * eachFactor2).
+ t2 := (eachFactor2 * eachFactor1).
+
+ self assert:(t1 = t2).
t1 = 20203181441155852828228393631745 ifTrue:[
eachFactor1 = 1099511627775 ifTrue:[
self halt
]].
- self assert:(t1 / eachFactor1) = eachFactor2.
- self assert:(t1 / eachFactor2) = eachFactor1.
- t3 := (eachFactor1 asLargeInteger * eachFactor2 asLargeInteger).
- self assert: t1 = t3.
- ].
+ self assert:(t1 / eachFactor1) = eachFactor2.
+ self assert:(t1 / eachFactor2) = eachFactor1.
+ t3 := (eachFactor1 asLargeInteger * eachFactor2 asLargeInteger).
+ self assert: t1 = t3.
+ ].
].
-
+
"
self basicNew testLargeMultiplication
"
@@ -2505,13 +2505,13 @@
t1 := LargeInteger digitBytes:#[ 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF].
t2 := LargeInteger digitBytes:#[ 16rFF 16rFF 16rFF 16rFF 16rFF 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r printString = '20282409603633223678774030106625').
self assert:(r hexPrintString = 'FFFFFFFFFEFFFFFF0000000001').
t1 := LargeInteger digitBytes:#[ 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF].
t2 := LargeInteger digitBytes:#[ 16rFF 16rFF 16rFF 16rFF 16rFF 16rFF 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r printString = '5192296858534809181504947642957825').
self assert:(r hexPrintString = 'FFFFFFFFFFFEFFFF000000000001').
@@ -2534,39 +2534,39 @@
"/ testing internal multiplication method
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '12100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '1412100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '161412100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11 12].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '18161412100E0C0A08060402').
-
+
"/ --------
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '12100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10].
@@ -2576,24 +2576,24 @@
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '161412100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11 12].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '18161412100E0C0A08060402').
"/ --------
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '12100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10].
@@ -2603,24 +2603,24 @@
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '161412100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11 12].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '18161412100E0C0A08060402').
"/ --------
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '12100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10].
@@ -2630,12 +2630,12 @@
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '161412100E0C0A08060402').
t1 := LargeInteger digitBytes:#[ 1 2 3 4 5 6 7 8 9 10 11 12].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '18161412100E0C0A08060402').
@@ -2643,88 +2643,88 @@
t1 := LargeInteger digitBytes:#[ 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300').
t1 := LargeInteger digitBytes:#[ 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300').
t1 := LargeInteger digitBytes:#[ 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300').
t1 := LargeInteger digitBytes:#[ 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300').
"/ ---------
t1 := LargeInteger digitBytes:#[ 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '20202020202030000').
t1 := LargeInteger digitBytes:#[ 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '20202020202030000').
t1 := LargeInteger digitBytes:#[ 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '20202020202030000').
t1 := LargeInteger digitBytes:#[ 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '20202020202030000').
"/ ---------
t1 := LargeInteger digitBytes:#[ 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '2020202020203000000').
t1 := LargeInteger digitBytes:#[ 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '2020202020203000000').
t1 := LargeInteger digitBytes:#[ 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '2020202020203000000').
t1 := LargeInteger digitBytes:#[ 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '2020202020203000000').
"/ ---------
t1 := LargeInteger digitBytes:#[ 0 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300000000').
t1 := LargeInteger digitBytes:#[ 0 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300000000').
t1 := LargeInteger digitBytes:#[ 0 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300000000').
t1 := LargeInteger digitBytes:#[ 0 0 0 128 1 1 1 1 1 1 1].
t2 := LargeInteger digitBytes:#[ 2 0 0 0 0 0 0 0 0 0 0].
- r := t1 absMul:t2.
+ r := t1 absMul:t2.
self assert:(r hexPrintString = '202020202020300000000').
"
@@ -3118,36 +3118,36 @@
self assert:(16r10000000000000000 hexPrintString = '10000000000000000').
self assert:(16r100000000000000000 hexPrintString = '100000000000000000').
- self assert:(126 printString) = '126'.
- self assert:(127 printString) = '127'.
- self assert:(128 printString) = '128'.
-
- self assert:(255 printString) = '255'.
- self assert:(256 printString) = '256'.
- self assert:(257 printString) = '257'.
-
- self assert:(32767 printString) = '32767'.
- self assert:(32768 printString) = '32768'.
- self assert:(32769 printString) = '32769'.
-
- self assert:(65535 printString) = '65535'.
- self assert:(65536 printString) = '65536'.
- self assert:(65537 printString) = '65537'.
-
- self assert:(2147483647 printString) = '2147483647'.
- self assert:(2147483648 printString) = '2147483648'.
- self assert:(2147483649 printString) = '2147483649'.
-
- self assert:(4294967295 printString) = '4294967295'.
- self assert:(4294967296 printString) = '4294967296'.
- self assert:(4294967297 printString) = '4294967297'.
-
- self assert:(127 printStringRadix:16) = '7F'.
- self assert:(123 printStringRadix:12) = 'A3'.
- self assert:(123 printStringRadix:10) = '123'.
- self assert:(123 printStringRadix:8 ) = '173'.
- self assert:(123 printStringRadix:3 ) = '11120'.
- self assert:(123 printStringRadix:2 ) = '1111011'.
+ self assert:(126 printString) = '126'.
+ self assert:(127 printString) = '127'.
+ self assert:(128 printString) = '128'.
+
+ self assert:(255 printString) = '255'.
+ self assert:(256 printString) = '256'.
+ self assert:(257 printString) = '257'.
+
+ self assert:(32767 printString) = '32767'.
+ self assert:(32768 printString) = '32768'.
+ self assert:(32769 printString) = '32769'.
+
+ self assert:(65535 printString) = '65535'.
+ self assert:(65536 printString) = '65536'.
+ self assert:(65537 printString) = '65537'.
+
+ self assert:(2147483647 printString) = '2147483647'.
+ self assert:(2147483648 printString) = '2147483648'.
+ self assert:(2147483649 printString) = '2147483649'.
+
+ self assert:(4294967295 printString) = '4294967295'.
+ self assert:(4294967296 printString) = '4294967296'.
+ self assert:(4294967297 printString) = '4294967297'.
+
+ self assert:(127 printStringRadix:16) = '7F'.
+ self assert:(123 printStringRadix:12) = 'A3'.
+ self assert:(123 printStringRadix:10) = '123'.
+ self assert:(123 printStringRadix:8 ) = '173'.
+ self assert:(123 printStringRadix:3 ) = '11120'.
+ self assert:(123 printStringRadix:2 ) = '1111011'.
self should:[ 123 printStringRadix:1 ] raise:Error.
"
@@ -3226,11 +3226,11 @@
"addition with overflow"
SmallInteger maxBytes == 4 ifTrue:[
- n1 := 16r3FFFFFFF.
- n2 := -16r40000000.
+ n1 := 16r3FFFFFFF.
+ n2 := -16r40000000.
] ifFalse:[
- n1 := 16r3FFFFFFFFFFFFFFF.
- n2 := -16r4000000000000000.
+ n1 := 16r3FFFFFFFFFFFFFFF.
+ n2 := -16r4000000000000000.
].
self assert:(n1 class == SmallInteger).
self assert:(n2 class == SmallInteger).
@@ -3671,9 +3671,9 @@
self assert:((n2 perform:'*' asSymbol with:2) printString = '-2147483646').
SmallInteger maxBytes == 4 ifTrue:[
- n1 := 16r3FFFFFFF.
+ n1 := 16r3FFFFFFF.
] ifFalse:[
- n1 := 16r3FFFFFFFFFFFFFFF.
+ n1 := 16r3FFFFFFFFFFFFFFF.
].
self assert:(n1 class == SmallInteger).
self assert:((n1 * 2) class == LargeInteger).
@@ -3698,42 +3698,42 @@
testCreationFromBytes1
"self run: #testCreationFromBytes1"
- " it is illegal for a LargeInteger to be less than SmallInteger maxVal."
+ " it is illegal for a LargeInteger to be less than SmallInteger maxVal."
" here we test that Integer>>byte!!byte2:byte3:byte4: reconstructs SmallInteger maxVal as an instance of SmallInteger. "
- | maxSmallInt hexString
- byte1 byte2 byte3 byte4
- byte5 byte6 byte7 byte8
+ | maxSmallInt hexString
+ byte1 byte2 byte3 byte4
+ byte5 byte6 byte7 byte8
builtInteger builtIntegerH builtIntegerL|
maxSmallInt := SmallInteger maxVal.
hexString := maxSmallInt printStringHex.
ExternalAddress pointerSize == 8 ifTrue:[
- self assert: hexString size = 16.
-
- byte8 := Integer readFrom: (hexString copyFrom: 1 to: 2) base: 16.
- byte7 := Integer readFrom: (hexString copyFrom: 3 to: 4) base: 16.
- byte6 := Integer readFrom: (hexString copyFrom: 5 to: 6) base: 16.
- byte5 := Integer readFrom: (hexString copyFrom: 7 to: 8) base: 16.
- byte4 := Integer readFrom: (hexString copyFrom: 9 to: 10) base: 16.
- byte3 := Integer readFrom: (hexString copyFrom: 11 to: 12) base: 16.
- byte2 := Integer readFrom: (hexString copyFrom: 13 to: 14) base: 16.
- byte1 := Integer readFrom: (hexString copyFrom: 15 to: 16) base: 16.
-
- builtIntegerH := Integer byte1: byte5 byte2: byte6 byte3: byte7 byte4: byte8.
- builtIntegerL := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
- builtInteger := (builtIntegerH bitShift:32) bitOr:builtIntegerL.
- self assert: builtInteger = maxSmallInt.
+ self assert: hexString size = 16.
+
+ byte8 := Integer readFrom: (hexString copyFrom: 1 to: 2) base: 16.
+ byte7 := Integer readFrom: (hexString copyFrom: 3 to: 4) base: 16.
+ byte6 := Integer readFrom: (hexString copyFrom: 5 to: 6) base: 16.
+ byte5 := Integer readFrom: (hexString copyFrom: 7 to: 8) base: 16.
+ byte4 := Integer readFrom: (hexString copyFrom: 9 to: 10) base: 16.
+ byte3 := Integer readFrom: (hexString copyFrom: 11 to: 12) base: 16.
+ byte2 := Integer readFrom: (hexString copyFrom: 13 to: 14) base: 16.
+ byte1 := Integer readFrom: (hexString copyFrom: 15 to: 16) base: 16.
+
+ builtIntegerH := Integer byte1: byte5 byte2: byte6 byte3: byte7 byte4: byte8.
+ builtIntegerL := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
+ builtInteger := (builtIntegerH bitShift:32) bitOr:builtIntegerL.
+ self assert: builtInteger = maxSmallInt.
] ifFalse:[
- self assert: hexString size = 8.
-
- byte4 := Integer readFrom: (hexString copyFrom: 1 to: 2) base: 16.
- byte3 := Integer readFrom: (hexString copyFrom: 3 to: 4) base: 16.
- byte2 := Integer readFrom: (hexString copyFrom: 5 to: 6) base: 16.
- byte1 := Integer readFrom: (hexString copyFrom: 7 to: 8) base: 16.
-
- builtInteger := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
- self assert: builtInteger = maxSmallInt.
+ self assert: hexString size = 8.
+
+ byte4 := Integer readFrom: (hexString copyFrom: 1 to: 2) base: 16.
+ byte3 := Integer readFrom: (hexString copyFrom: 3 to: 4) base: 16.
+ byte2 := Integer readFrom: (hexString copyFrom: 5 to: 6) base: 16.
+ byte1 := Integer readFrom: (hexString copyFrom: 7 to: 8) base: 16.
+
+ builtInteger := Integer byte1: byte1 byte2: byte2 byte3: byte3 byte4: byte4.
+ self assert: builtInteger = maxSmallInt.
].
self assert: builtInteger class = SmallInteger
! !
@@ -3753,56 +3753,56 @@
eqEnc := rack.
eqEnc > 0 ifFalse:[
- eqEnc < 0 ifTrue:[idn := #Dontcare]
- ifFalse:[port == 256 ifTrue:[idn := #NWNode]
- ifFalse:[ idn := #Unspecified ]].
+ eqEnc < 0 ifTrue:[idn := #Dontcare]
+ ifFalse:[port == 256 ifTrue:[idn := #NWNode]
+ ifFalse:[ idn := #Unspecified ]].
^ idn
].
eqEnc >= 255 ifTrue:[ "/ is a logical resource
- eqEnc > 255 ifTrue:[ ^ #Unspecified ].
-
- slot == 0 ifTrue:[
- subr == 1 ifTrue:[ ^ #ConnectManager ].
- subr == 2 ifTrue:[ ^ #ClockManager ].
- ].
- oid := 4. "/ logical resource
+ eqEnc > 255 ifTrue:[ ^ #Unspecified ].
+
+ slot == 0 ifTrue:[
+ subr == 1 ifTrue:[ ^ #ConnectManager ].
+ subr == 2 ifTrue:[ ^ #ClockManager ].
+ ].
+ oid := 4. "/ logical resource
] ifFalse:[
- oid := 2. "/ equipment
+ oid := 2. "/ equipment
].
hgEnc := 0.
typ := aTypeOrSymbol.
subr ~~ 0 ifTrue:[
- subr > 16r0f ifTrue:[ ^ #Unspecified ].
- eqEnc := eqEnc bitOr:(subr bitShift: 8).
-
- slot ~~ 0 ifTrue:[
- slot > 16rff ifTrue:[ ^ #Unspecified ].
- eqEnc := eqEnc bitOr:(slot bitShift:12).
-
- port ~~ 0 ifTrue:[
- port > 16rff ifTrue:[ ^ #Unspecified ].
- eqEnc := eqEnc bitOr:(port bitShift:20).
-
- chn ~~ 0 ifTrue:[
- chn > 16rfff ifTrue:[ ^ #Unspecified ].
- oid := 3.
- typ := aTypeOrSymbol ? 0.
- hgEnc := chn.
- ]
- ]
- ]
+ subr > 16r0f ifTrue:[ ^ #Unspecified ].
+ eqEnc := eqEnc bitOr:(subr bitShift: 8).
+
+ slot ~~ 0 ifTrue:[
+ slot > 16rff ifTrue:[ ^ #Unspecified ].
+ eqEnc := eqEnc bitOr:(slot bitShift:12).
+
+ port ~~ 0 ifTrue:[
+ port > 16rff ifTrue:[ ^ #Unspecified ].
+ eqEnc := eqEnc bitOr:(port bitShift:20).
+
+ chn ~~ 0 ifTrue:[
+ chn > 16rfff ifTrue:[ ^ #Unspecified ].
+ oid := 3.
+ typ := aTypeOrSymbol ? 0.
+ hgEnc := chn.
+ ]
+ ]
+ ]
].
typ notNil ifTrue:[
- typ isSymbol ifTrue:[
- typ := 0
- ].
- hgEnc := hgEnc bitOr:(typ bitShift:12).
- hgEnc := hgEnc bitOr:(oid bitShift:20).
- ].
+ typ isSymbol ifTrue:[
+ typ := 0
+ ].
+ hgEnc := hgEnc bitOr:(typ bitShift:12).
+ hgEnc := hgEnc bitOr:(oid bitShift:20).
+ ].
^ #ok.
"
@@ -3842,34 +3842,34 @@
"/ typ := aTypeOrSymbol.
subr ~~ 0 ifTrue:[
- subr > 16r0f ifTrue:[ ^ nil "self fromIdn:(IDN Unspecified)" ].
- eqEnc := eqEnc bitOr:(subr bitShift: 8).
-
- slot ~~ 0 ifTrue:[
- slot > 16rff ifTrue:[ ^ nil "self fromIdn:(IDN Unspecified)" ].
- eqEnc := eqEnc bitOr:(slot bitShift:12).
-
- port ~~ 0 ifTrue:[
- port > 16rff ifTrue:[ ^ self fromIdn:(IDN Unspecified) ].
- eqEnc := eqEnc bitOr:(port bitShift:20).
-
- chn ~~ 0 ifTrue:[
- chn > 16rfff ifTrue:[ ^ self fromIdn:(IDN Unspecified) ].
- oid := 3.
- typ := aTypeOrSymbol ? 0.
- hgEnc := chn.
- ]
- ]
- ]
+ subr > 16r0f ifTrue:[ ^ nil "self fromIdn:(IDN Unspecified)" ].
+ eqEnc := eqEnc bitOr:(subr bitShift: 8).
+
+ slot ~~ 0 ifTrue:[
+ slot > 16rff ifTrue:[ ^ nil "self fromIdn:(IDN Unspecified)" ].
+ eqEnc := eqEnc bitOr:(slot bitShift:12).
+
+ port ~~ 0 ifTrue:[
+ port > 16rff ifTrue:[ ^ self fromIdn:(IDN Unspecified) ].
+ eqEnc := eqEnc bitOr:(port bitShift:20).
+
+ chn ~~ 0 ifTrue:[
+ chn > 16rfff ifTrue:[ ^ self fromIdn:(IDN Unspecified) ].
+ oid := 3.
+ typ := aTypeOrSymbol ? 0.
+ hgEnc := chn.
+ ]
+ ]
+ ]
].
typ notNil ifTrue:[
- typ isSymbol ifTrue:[
- typ := (MDT::MDTCType asNumberType:typ) ? 0
- ].
- hgEnc := hgEnc bitOr:(typ bitShift:12).
- hgEnc := hgEnc bitOr:(oid bitShift:20).
- ].
+ typ isSymbol ifTrue:[
+ typ := (MDT::MDTCType asNumberType:typ) ? 0
+ ].
+ hgEnc := hgEnc bitOr:(typ bitShift:12).
+ hgEnc := hgEnc bitOr:(oid bitShift:20).
+ ].
^ self basicNew eqEncode:eqEnc hgEncode:hgEnc.
"
@@ -3878,173 +3878,123 @@
!
test_gcdBug1
-| theBase theMersenne theRest theGcd theOldRest theOldGcd |
-theBase := 2.
-
-132 to: 135 do:
-[: theOrder |
- false "<<<< here i replaced some piece of code by false just to
-reproduce the error without having to ship all my code >>>>"
- ifFalse: [
-
- theRest := ((theBase raisedTo: theOrder) - 1) / (theBase - 1).
- 30 to: 67 "theOrder - 1" do:
- [:theFactorOrder |
-"/Transcript show:theOrder; space.
-"/Transcript showCR:theFactorOrder.
- (theOrder \\ theFactorOrder) = 0
- ifTrue: [ "<<<< is a divisor of the order >>>>"
-
- theFactorOrder = 131 ifTrue: ['131 ist kein Teiler von 132'
-halt].
- (theOrder / theFactorOrder) isFraction
- ifTrue: [
- self halt "Fehler!!" "<<<<<<<<< dieser Code wird
- nicht ausgeführt!!!!!! >>>>>"
- ].
-
- theMersenne := ((theBase raisedTo: theFactorOrder) - 1) /
-(theBase - 1).
-
- theGcd := theRest gcd: theMersenne.
- [theGcd > 1]
- whileTrue: [
- theFactorOrder > 129 ifTrue: [self halt]."< no halt!! >"
- theOldRest := theRest asString.
- theOldGcd := theGcd asString.
- theRest := theRest / theGcd.
- theGcd := theGcd gcd: theRest. "<<<<<<<<< ERROR
->>>>>>>"
- ((theRest \\ theGcd) ~= 0) ifTrue: [self halt].
- (theRest / theGcd) isFraction ifTrue: [self halt.].
- ].
- ].
- ].
- theRest = 1 ifTrue: [ "<<<< there is no prime factor of order
-theOrder >>>>"
- theOrder halt
- ].
- ].
-].
+ |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+
+ theBase := 2.
+ 132 to:135 do:[:theOrder |
+ false " <<<< here i replaced some piece of code by false just to reproduce the error without having to ship all my code >>>>" ifFalse:[
+ theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+ 30 "theOrder - 1" to:67 do:[:theFactorOrder |
+ "/Transcript show:theOrder; space.
+ "/Transcript showCR:theFactorOrder.
+ (theOrder \\ theFactorOrder) = 0 ifTrue:[
+ " <<<< is a divisor of the order >>>>"
+ self assert:theFactorOrder ~= 131
+ description:'131 ist kein Teiler von 132'.
+ self assert:(theOrder / theFactorOrder) isFraction not.
+ theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+ theGcd := theRest gcd:theMersenne.
+ [ theGcd > 1 ] whileTrue:[
+ self assert:theFactorOrder < 129.
+ theOldRest := theRest asString.
+ theOldGcd := theGcd asString.
+ theRest := theRest / theGcd.
+ theGcd := theGcd gcd:theRest.
+ self assert:((theRest \\ theGcd) = 0).
+ self assert:(theRest / theGcd) isFraction not.
+ ].
+ ].
+ ].
+ self assert:theRest ~= 1
+ description:'there is no prime factor of order theOrder'
+ ].
+ ].
"
self new test_gcdBug1
"
-
"Modified: / 27-04-2010 / 00:02:02 / cg"
!
test_gcdBug2
-| theBase theMersenne theRest theGcd theOldRest theOldGcd |
-theBase := 2.
-
-132 to: 135 do:
-[: theOrder |
- false "<<<< here i replaced some piece of code by false just to
-reproduce the error without having to ship all my code >>>>"
- ifFalse: [
-
- theRest := ((theBase raisedTo: theOrder) - 1) / (theBase - 1).
- 60 to: 67 "theOrder - 1" do:
- [:theFactorOrder |
-"/Transcript show:theOrder; space.
-"/Transcript showCR:theFactorOrder.
- (theOrder \\ theFactorOrder) = 0
- ifTrue: [ "<<<< is a divisor of the order >>>>"
-
- theFactorOrder = 131 ifTrue: ['131 ist kein Teiler von 132'
-halt].
- (theOrder / theFactorOrder) isFraction
- ifTrue: [
- self halt "Fehler!!" "<<<<<<<<< dieser Code wird
- nicht ausgeführt!!!!!! >>>>>"
- ].
-
- theMersenne := ((theBase raisedTo: theFactorOrder) - 1) /
-(theBase - 1).
-
- theGcd := theRest gcd: theMersenne.
- [theGcd > 1]
- whileTrue: [
- theFactorOrder > 129 ifTrue: [self halt]."< no halt!! >"
- theOldRest := theRest asString.
- theOldGcd := theGcd asString.
- theRest := theRest / theGcd.
- theGcd := theGcd gcd: theRest. "<<<<<<<<< ERROR
->>>>>>>"
- ((theRest \\ theGcd) ~= 0) ifTrue: [self halt].
- (theRest / theGcd) isFraction ifTrue: [self halt.].
- ].
- ].
- ].
- theRest = 1 ifTrue: [ "<<<< there is no prime factor of order
-theOrder >>>>"
- theOrder halt
- ].
- ].
-].
+ |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+
+ theBase := 2.
+ 132 to:135 do:[:theOrder |
+ false " <<<< here i replaced some piece of code by false just to
+ reproduce the error without having to ship all my code >>>>"
+ ifFalse:[
+ theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+ 60 "theOrder - 1" to:67 do:[:theFactorOrder |
+ "/Transcript show:theOrder; space.
+ "/Transcript showCR:theFactorOrder.
+ (theOrder \\ theFactorOrder) = 0 ifTrue:[
+ " <<<< is a divisor of the order >>>>"
+ self assert:theFactorOrder ~= 131
+ description:'131 ist kein Teiler von 132'.
+ self assert:(theOrder / theFactorOrder) isFraction not.
+ theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+ theGcd := theRest gcd:theMersenne.
+ [ theGcd > 1 ] whileTrue:[
+ self assert:theFactorOrder < 129.
+ theOldRest := theRest asString.
+ theOldGcd := theGcd asString.
+ theRest := theRest / theGcd.
+ theGcd := theGcd gcd:theRest.
+ self assert:((theRest \\ theGcd) = 0).
+ self assert:(theRest / theGcd) isFraction not.
+ ].
+ ].
+ ].
+ self assert:theRest ~= 1
+ description:'there is no prime factor of order theOrder'
+ ].
+ ].
"
self new test_gcdBug2
"
-
"Modified: / 27-04-2010 / 00:02:09 / cg"
!
test_gcdBug3
-| theBase theMersenne theRest theGcd theOldRest theOldGcd |
-theBase := 2.
-
-132 to: 135 do:
-[: theOrder |
- false "<<<< here i replaced some piece of code by false just to
-reproduce the error without having to ship all my code >>>>"
- ifFalse: [
-
- theRest := ((theBase raisedTo: theOrder) - 1) / (theBase - 1).
- 2 to:theOrder - 1 do:
- [:theFactorOrder |
-"/Transcript show:theOrder; space.
-"/Transcript showCR:theFactorOrder.
- (theOrder \\ theFactorOrder) = 0
- ifTrue: [ "<<<< is a divisor of the order >>>>"
-
- theFactorOrder = 131 ifTrue: ['131 ist kein Teiler von 132'
-halt].
- (theOrder / theFactorOrder) isFraction
- ifTrue: [
- self halt "Fehler!!" "<<<<<<<<< dieser Code wird
- nicht ausgeführt!!!!!! >>>>>"
- ].
-
- theMersenne := ((theBase raisedTo: theFactorOrder) - 1) /
-(theBase - 1).
-
- theGcd := theRest gcd: theMersenne.
- [theGcd > 1]
- whileTrue: [
- theFactorOrder > 129 ifTrue: [self halt]."< no halt!! >"
- theOldRest := theRest asString.
- theOldGcd := theGcd asString.
- theRest := theRest / theGcd.
- theGcd := theGcd gcd: theRest. "<<<<<<<<< ERROR
->>>>>>>"
- ((theRest \\ theGcd) ~= 0) ifTrue: [self halt].
- (theRest / theGcd) isFraction ifTrue: [self halt.].
- ].
- ].
- ].
- theRest = 1 ifTrue: [ "<<<< there is no prime factor of order
-theOrder >>>>"
- theOrder halt
- ].
- ].
-].
+ |theBase theMersenne theRest theGcd theOldRest theOldGcd|
+
+ theBase := 2.
+ 132 to:135 do:[:theOrder |
+ false " <<<< here i replaced some piece of code by false just to
+ reproduce the error without having to ship all my code >>>>"
+ ifFalse:[
+ theRest := ((theBase raisedTo:theOrder) - 1) / (theBase - 1).
+ 2 to:theOrder - 1 do:[:theFactorOrder |
+ "/Transcript show:theOrder; space.
+ "/Transcript showCR:theFactorOrder.
+ (theOrder \\ theFactorOrder) = 0 ifTrue:[
+ " <<<< is a divisor of the order >>>>"
+ self assert:theFactorOrder ~= 131
+ description:'131 ist kein Teiler von 132'.
+ self assert:(theOrder / theFactorOrder) isFraction not.
+ theMersenne := ((theBase raisedTo:theFactorOrder) - 1) / (theBase - 1).
+ theGcd := theRest gcd:theMersenne.
+ [ theGcd > 1 ] whileTrue:[
+ self assert:theFactorOrder < 129.
+ theOldRest := theRest asString.
+ theOldGcd := theGcd asString.
+ theRest := theRest / theGcd.
+ theGcd := theGcd gcd:theRest.
+ self assert:((theRest \\ theGcd) = 0).
+ self assert:(theRest / theGcd) isFraction not.
+ ].
+ ].
+ ].
+ self assert:theRest ~= 1
+ description:'there is no prime factor of order theOrder'
+ ].
+ ].
"
- self new test_gcdBug2
+ self new test_gcdBug3
"
-
"Modified: / 27-04-2010 / 00:02:15 / cg"
! !