On Wed, 2 Jun 2010, Henrik Sperre Johansen wrote:

On 02.06.2010 00:15, Alexandre Bergel wrote:
Hi!

Apparently in Pharo 1.1, hash values may be greater than 4096. What is the range of the hash values?

Cheers,
Alexandre

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Hash values could always be greater than 4096 :)
Identity hashes can't, but they are scaled in 1.1, to avoid bad clustering

That's not true. You may be surprised, but the value of #identityHash can be any SmallInteger. Just try this:
{SmallInteger minVal. SmallInteger maxVal} collect: #identityHash.

for objects not redefining hash.
Basically they're multiplied by 2^18, which gives the largest possible range while still keeping all small integers. See ProtoObject>>identityHash for details, old identityHash is now basicIdentityHash.

This may cause compatibility problems for packages which implement custom hashes or custom hashed collections. I think Magma will be affected by this, though I didn't check the code.


Levente

Cheers,
Henry

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to