Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.811.mcz
==================== Summary ====================
Name: Collections-eem.811
Author: eem
Time: 31 October 2018, 10:44:24.941583 am
UUID: a01f9f2a-1915-4520-8dbd-dfe7f43b1026
Ancestors: Collections-ul.810
Use the integerAt[Put] primitive to implement signedByteAt:[put:]
=============== Diff against Collections-ul.810 ===============
Item was changed:
----- Method: ByteArray>>signedByteAt: (in category 'platform independent access') -----
signedByteAt: index
+ "Answer an 8-bit signed integer quantity from the given byte index."
+ <primitive: 165>
- "Return an 8-bit signed integer quantity from the given byte index."
-
| byte |
(byte := self at: index) <= 16r7F ifTrue: [ ^byte ].
^byte - 16r100!
Item was changed:
----- Method: ByteArray>>signedByteAt:put: (in category 'platform independent access') -----
signedByteAt: index put: anInteger
"Store an 8-bit signed integer quantity at the given byte index."
+ <primitive: 166>
-
anInteger >= 0 ifTrue: [ ^self at: index put: anInteger ].
self at: index put: anInteger + 16r100.
^anInteger!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.810.mcz
==================== Summary ====================
Name: Collections-ul.810
Author: ul
Time: 30 October 2018, 1:26:22.149414 am
UUID: 33532c8f-187e-4914-9573-9a6a5390a97c
Ancestors: Collections-topa.809
- renamed the methods #stringHashWithInitialHash: and #bytesHashWithInitialHash: to #hashWithInitialHash:
=============== Diff against Collections-topa.809 ===============
Item was removed:
- ----- Method: ByteArray>>bytesHashWithInitialHash: (in category 'private') -----
- bytesHashWithInitialHash: speciesHash
- "Answer the hash of a byte-indexed array, using speciesHash as the initial value.
- See SmallInteger>>hashMultiply."
- <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
-
- ^String stringHash: self initialHash: speciesHash!
Item was changed:
----- Method: ByteArray>>hash (in category 'comparing') -----
hash
"#hash is implemented, because #= is implemented"
+ ^self hashWithInitialHash: self species hash!
- ^self bytesHashWithInitialHash: self species hash!
Item was added:
+ ----- Method: ByteArray>>hashWithInitialHash: (in category 'private') -----
+ hashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed array, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^String stringHash: self initialHash: speciesHash!
Item was added:
+ ----- Method: ByteString>>hashWithInitialHash: (in category 'private') -----
+ hashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^super hashWithInitialHash: speciesHash!
Item was removed:
- ----- Method: ByteString>>stringHashWithInitialHash: (in category 'private') -----
- stringHashWithInitialHash: speciesHash
- "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
- See SmallInteger>>hashMultiply."
- <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
-
- ^super stringHashWithInitialHash: speciesHash!
Item was added:
+ ----- Method: ByteSymbol>>hashWithInitialHash: (in category 'private') -----
+ hashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
+
+ ^super hashWithInitialHash: speciesHash!
Item was removed:
- ----- Method: ByteSymbol>>stringHashWithInitialHash: (in category 'private') -----
- stringHashWithInitialHash: speciesHash
- "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
- See SmallInteger>>hashMultiply."
- <primitive: 'primitiveStringHash' module: 'MiscPrimitivePlugin'>
-
- ^super stringHashWithInitialHash: speciesHash!
Item was changed:
----- Method: String>>hash (in category 'comparing') -----
hash
"#hash is implemented, because #= is implemented"
"ar 4/10/2005: I had to change this to use ByteString hash as initial
hash in order to avoid having to rehash everything and yet compute
the same hash for ByteString and WideString.
md 16/10/2006: use identityHash as initialHash, as behavior hash will
use String hash (name) to have a better hash soon.
eem 4/17/2017 it's not possible to use String hash (name) for the
initial hash because that would be recursive."
+ ^self hashWithInitialHash: ByteString identityHash!
- ^self stringHashWithInitialHash: ByteString identityHash!
Item was changed:
+ ----- Method: String>>hashWithInitialHash: (in category 'private') -----
+ hashWithInitialHash: speciesHash
+ "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ See SmallInteger>>hashMultiply."
+ | hash |
+ hash := speciesHash bitAnd: 16r0FFFFFFF.
+ 1 to: self size do:
+ [:pos |
+ hash := (hash + (self basicAt: pos)) hashMultiply].
+ ^hash!
- ----- Method: String>>hashWithInitialHash: (in category 'comparing') -----
- hashWithInitialHash: initialHash
-
- ^ self class stringHash: self initialHash: initialHash!
Item was removed:
- ----- Method: String>>stringHashWithInitialHash: (in category 'private') -----
- stringHashWithInitialHash: speciesHash
- "Answer the hash of a byte-indexed string, using speciesHash as the initial value.
- See SmallInteger>>hashMultiply."
- | hash |
- hash := speciesHash bitAnd: 16r0FFFFFFF.
- 1 to: self size do:
- [:pos |
- hash := (hash + (self basicAt: pos)) hashMultiply].
- ^hash!
Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1193.mcz
==================== Summary ====================
Name: Kernel-eem.1193
Author: eem
Time: 29 October 2018, 4:05:45.263515 pm
UUID: 003c6ae4-79d6-48f7-8f8a-9cc1a37690f8
Ancestors: Kernel-ul.1192
Provide changeClassTo: as a convenient way of accessing adoptInstance:, and a better replacement for the older primitiveChangeClassTo:.
=============== Diff against Kernel-ul.1192 ===============
Item was added:
+ ----- Method: Object>>changeClassTo: (in category 'converting') -----
+ changeClassTo: aBehavior
+ "Change the class of the receiver to the argument, provided
+ that the format of the argument matches the format of the receiver's class."
+ aBehavior adoptInstance: self.
+ ^self!
Tobias Pape uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-topa.809.mcz
==================== Summary ====================
Name: Collections-topa.809
Author: topa
Time: 28 October 2018, 8:16:44.149252 pm
UUID: 65e8b64d-f325-47d8-8f83-ab4a9793ba9f
Ancestors: Collections-eem.808
Add #histogramOf: convenience + test
=============== Diff against Collections-eem.808 ===============
Item was added:
+ ----- Method: Collection>>histogramOf: (in category 'converting') -----
+ histogramOf: aBlock
+
+ ^ self collect: aBlock as: Bag!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1192.mcz
==================== Summary ====================
Name: Kernel-ul.1192
Author: ul
Time: 24 October 2018, 10:50:43.875546 pm
UUID: 72dfb776-3d77-4b84-9d69-d000e9a67ae1
Ancestors: Kernel-eem.1191
- improved Integer >> #isPrime's performance
- slightly faster Categorizer >> #numberOfCategoryOfElement:
=============== Diff against Kernel-eem.1191 ===============
Item was changed:
----- Method: Categorizer>>numberOfCategoryOfElement: (in category 'accessing') -----
numberOfCategoryOfElement: element
"Answer the index of the category with which the argument, element, is
associated."
+ | categoryIndex elementIndex elementArraySize |
- | categoryIndex elementIndex |
categoryIndex := 1.
elementIndex := 0.
+ elementArraySize := elementArray size.
+ [(elementIndex := elementIndex + 1) <= elementArraySize]
- [(elementIndex := elementIndex + 1) <= elementArray size]
whileTrue:
["point to correct category"
[elementIndex > (categoryStops at: categoryIndex)]
whileTrue: [categoryIndex := categoryIndex + 1].
"see if this is element"
element = (elementArray at: elementIndex) ifTrue: [^categoryIndex]].
^0!
Item was changed:
----- Method: Integer>>isPrime (in category 'testing') -----
isPrime
"Answer true if the receiver is a prime number. See isProbablyPrime for a probabilistic
implementation that is much faster for large integers, and that is correct to an extremely
high statistical level of confidence (effectively deterministic)."
+ | probe step limit |
+ self <= 3 ifTrue: [ ^self >= 2 ].
+ self \\ 2 = 0 ifTrue: [ ^false ].
+ self \\ 3 = 0 ifTrue: [ ^false ].
+ self <= 1073741823 ifFalse: [ "1 << 30 - 1. For numbers larger than this (on 64-bit platforms) #isProbablyPrime is usually quicker."
- self <= 1 ifTrue: [ ^false ].
- self even ifTrue: [ ^self = 2].
- self <= 1073741823 ifFalse: [ "1 << 30 - 1. For numbers larger than this, the calculation takes longer than #isProbablyPrime when the receiver is a prime. The absolue turning point is about at 1 << 35 - 1."
^self isProbablyPrime ].
+ probe := 5.
+ step := 2. "Step will oscillate between 2 and 4 because at this point self \\ 6 is either 1 or 5."
+ limit := self sqrtFloor. "On 64-bit platforms this could be written as self asFloat sqrt truncated (+ 1), which is faster because it creates no intermediate objects. Knowing that self has at most 30 bits because of the check above, this value will never be larger than 32767."
+ [ probe <= limit ] whileTrue: [
+ self \\ probe = 0 ifTrue: [ ^false ].
+ probe := probe + step.
+ step := 6 - step ].
- 3 to: self sqrtFloor by: 2 do: [ :each |
- self \\ each = 0 ifTrue: [ ^false ] ].
^true!
Item was added:
+ ----- Method: LargeNegativeInteger>>isPrime (in category 'testing') -----
+ isPrime
+
+ ^false!
David T. Lewis uploaded a new version of Chronology-Tests to project The Trunk:
http://source.squeak.org/trunk/Chronology-Tests-dtl.10.mcz
==================== Summary ====================
Name: Chronology-Tests-dtl.10
Author: dtl
Time: 22 October 2018, 11:03:15.772641 pm
UUID: a784eccd-7120-434e-9112-886b445aaffa
Ancestors: Chronology-Tests-pre.9
Start time for a Date created from a DateAndTime should preserve local time offset.
=============== Diff against Chronology-Tests-pre.9 ===============
Item was added:
+ ----- Method: DateTest>>testFromDateAndTime (in category 'Tests') -----
+ testFromDateAndTime
+
+ | aDateAndTime |
+ aDateAndTime := '2018-10-22T22:51:38.322706-04:00' asDateAndTime.
+ aDate := aDateAndTime asDate.
+ self
+ assert: aDate start offset
+ equals: aDateAndTime offset
+ description: 'Start time for a Date created from a DateAndTime should preserve local time offset'!