[squeak-dev] The Trunk: Collections-eem.746.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Apr 18 21:10:57 UTC 2017


Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.746.mcz

==================== Summary ====================

Name: Collections-eem.746
Author: eem
Time: 18 April 2017, 2:10:45.148995 pm
UUID: 8d9adaca-1401-4323-974f-1aed16ae3688
Ancestors: Collections-eem.745

Nuke the pointless override of ByteSString class>>stringHash:initialHash: in ByteSymbol class.  Rewrite the non-byte version to use the hashMultiply primitive.

=============== Diff against Collections-eem.745 ===============

Item was removed:
- ----- Method: ByteSymbol class>>stringHash:initialHash: (in category 'primitives') -----
- stringHash: aString initialHash: speciesHash
- 	^ByteString stringHash: aString initialHash: speciesHash!

Item was changed:
  ----- Method: String class>>stringHash:initialHash: (in category 'primitives') -----
  stringHash: aString initialHash: speciesHash
+ 	"Answer the hash of a byte-indexed string, using speciesHash as the initial value.
+ 	 See SmallInteger>>hashMultiply."
+ 	| hash |
- 
- 	| stringSize hash low |
- 	stringSize := aString size.
  	hash := speciesHash bitAnd: 16r0FFFFFFF.
+ 	1 to: aString size do:
+ 		[:pos |
+ 		hash := (hash + (aString basicAt: pos)) hashMultiply].
+ 	^hash!
- 	1 to: stringSize do: [ :pos |
- 		hash := hash + (aString basicAt: pos).
- 		"Begin hashMultiply"
- 		low := hash bitAnd: 16383.
- 		hash := (16r260D * low + ((16r260D * (hash // 16384) + (16r0065 * low) bitAnd: 16383) * 16384)) bitAnd: 16r0FFFFFFF ].
- 	^hash.
- 
- 
- !



More information about the Squeak-dev mailing list