[squeak-dev] [Pharo-dev] 32 vs 64 bits and large integer hash

Marcus Denker marcus.denker at inria.fr
Thu Nov 22 10:18:01 UTC 2018



> On 22 Nov 2018, at 10:47, Marcus Denker <marcus.denker at inria.fr> wrote:
> 
> 
> 
>> On 21 Nov 2018, at 19:45, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>> 
>> Hi All,
>> 
>>    right now we have the following definition of Large(Positive)Integer>>hash:
>> 
>> hash
>> 	^ByteArray hashBytes: self startingWith: self species hash
>> 
>> which means that for all integers outside of the 32-bit SmallInteger range (-2 ^ 30 to 2 ^ 30 - 1), the 32-bit system and the 64-bit system answer different values for hash.
>> 
>> e.g. in 64 bits: (2 raisedTo: 30) hash 1073741824
>> but in 32 bits: (2 raisedTo: 30) hash 230045764
>> 
>> This is unsatisfactory.  I propose changing Large(Positive)Integer>>hash to
>> 
>> hash
>> 	^self digitLength <= 8
>> 		ifTrue: [self]
>> 		ifFalse: [ByteArray hashBytes: self startingWith: self species hash]
>> 
>> 
> 
> Thanks, I added an issue tracker entry:
> 	
> 	https://pharo.fogbugz.com/f/cases/22690/32-vs-64-bits-and-large-integer-hash
> 
> I will do a pull request later (if not someone else is faster to do it).

https://github.com/pharo-project/pharo/pull/2009 <https://github.com/pharo-project/pharo/pull/2009>

> 
> --
> Marcus Denker  --  marcus at 2denker.de
> http://www.zweidenker.de

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20181122/61e3317c/attachment.html>


More information about the Squeak-dev mailing list