[squeak-dev] DateAndTime hashing

David T. Lewis lewis at mail.msen.com
Mon Jan 7 00:48:35 UTC 2019


On Sun, Jan 06, 2019 at 05:53:23PM -0600, Chris Muller wrote:
> > On Sat, Jan 05, 2019 at 08:53:52PM -0800, Eliot Miranda wrote:
> > > Hi David,
> > >
> > > > On Jan 5, 2019, at 8:17 PM, David T. Lewis <lewis at mail.msen.com> wrote:
> > > >
> > > > I don't think that this has a practical impact, but I will mention it
> > > > in case I am overlooking something. The hash for a DateAndTime in a
> > > > 64-bit image will be different from the hash for the same DateAndTime
> > > > in a 32-bit image, because the utcMicroseconds value in a 64-bit Spur
> > > > image is a SmallInteger, and in a 32-bit image it is a LargePositiveInteger.
> > >
> > > This was taken care of for this kind of scenario in
> > >
> > > Name: Kernel-eem.1198
> > > Author: eem
> > > Time: 24 November 2018, 1:44:47.526422 pm
> > > UUID: 100137c4-2514-4b7f-9064-3dcdfe7d8cc9
> > > Ancestors: Kernel-eem.1197
> > >
> > > Redefine LargePositiveInteger hash for compatibility between 32-bit
> > > and 64-bit systems.
> 
> Shouldn't the condition should be  ^self digitLength <= 4, instead of 8?
> 
> See?
> 
> 32-bit image
>    1073741824 hash =    230045764
> 
> 64-bit image
>    1073741824 hash  = 1073741824
> 
> I must be missing something.  I can't believe we didn't notice this
> and went into trunk before asking this question...
> 

Eeek!

This is crying out for a new unit test called IntegerTest>>testHash that documents
the expected hash values over various boundary conditions, including maxVal 32/64,
minVal 32/64, and digitLength 4 or 8. The test needs to pass on 32 and 64 bit images.

Dave


> 
> 
> 
> > Ah, right, I forgot about that update. I was looking at an outdated 32-bit image.
> >
> > Thanks!
> > Dave
> >
> >
> 


More information about the Squeak-dev mailing list