FW: [RFC] Integer hash
Norton, Chris
chrisn at Kronos.com
Fri Aug 9 00:36:30 UTC 2002
Since there's a bit of discussion on this topic, I'll let y'all in on the
private note I sent to Andreas on this subject.
He replied, saying that the VSE implementation (see bottom) offers something
that bitAnd: 16r3FFFFFFF doesn't.
Cheers,
---==> Chris
-----Original Message-----
From: Norton, Chris
Sent: Wednesday, August 07, 2002 5:45 PM
To: 'Andreas Raab'
Subject: RE: [RFC] Integer hash
Frankly, you're the expert as far as I'm concerned Andreas. FWIW, you get
my uneducated vote for inclusion. :-)
Just one thing though. When I looked up the implementation of the
LargeInteger>>hash in VisualAge Smalltalk, it looks like this:
LargeInteger>>hash
"Answer an Integer representing the hash
value of the receiver."
<primitive: VMprLargeIntegerHash>
^self bitAnd: 16r3FFFFFFF
I can only presume that the primitive call means that #hash is implemented
in the VM. Maybe Squeak's VM should implement the LargeInteger hash?
Perhaps that might speed it up even more?
Cheers,
---==> Chris
PS> This is what Visual Smalltalk Enterprise does:
LargeInteger>>hash
"Answer the integer hash value of the receiver."
| answer size |
size := self byteSize.
answer := ( self at: size ) bitAnd: 16r1F.
1 to: 3 do: [ :index |
answer := ( answer bitShift: 8 ) + ( self at: size - index ) ].
^answer
More information about the Squeak-dev
mailing list
|