The primitive and the primitive failure code should behave the same?

On 12/18/16 2:13 , stepharong wrote:
Sorry but how can we improve the situation concretely


Stef

On Wed, 14 Dec 2016 00:22:47 +0100, Andres Valloud
<avall...@smalltalk.comcastbiz.net> wrote:

Oh, ok... then the failure code isn't doing what was intended :).

On 12/13/16 15:16 , Martin McClure wrote:
On 12/13/2016 08:39 AM, Andres Valloud wrote:
I would have expected the floats to be a byte object of size 8.  Why is
this conversion needed?  Is somehow the primitive thinking the float
has
size 2?  Or is the primitive hashing 32 bits at a time?  The prim used
to be a C version of the byte oriented 1644525 multiplicative hash, did
this change?

The float is not a byte object of size 8, it's a word object of size 2.

When you feed it to #hashBytes:startingWith: the primitive fails. (I
didn't look at why -- maybe because it isn't a byte object?)

The alternative Smalltalk code treats it like it was a byte object, even
though it's not. So it iterates through the two words, multiplying each
by 1664525, then keeping only the low-order 28 bits of the result. But
since each word is a full 32 bits, the high-order four bits of each
word, which include the sign bit, can never affect the hash.

Regards,

-Martin





Reply via email to