<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi All,<div><br></div><div>    right now we have the following definition of Large(Positive)Integer>>hash:</div><div><br></div><div><div>hash</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>^ByteArray hashBytes: self startingWith: self species hash</div><div><br></div><div>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.</div><div><br></div><div>e.g. in 64 bits: (2 raisedTo: 30) hash 1073741824</div><div> but in 32 bits: (2 raisedTo: 30) hash 230045764</div><div><br></div><div>This is unsatisfactory.  I propose changing Large(Positive)Integer>>hash to</div><div><br></div><div><div>hash</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">     </span>^self digitLength <= 8</div><div><span style="white-space:pre">     </span><span style="white-space:pre">     ifTrue: [self]</span></div><div><span style="white-space:pre">        </span><span style="white-space:pre">     ifFalse: [</span>ByteArray hashBytes: self startingWith: self species hash]</div></div><div><br></div><div><br></div><div>P.S. Note that this will not break Float hash, which is defined as</div><div><br></div><div>Float>>hash</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>"Hash is reimplemented because = is implemented. Both words of the float are used. (The bitShift:'s ensure that the intermediate results do not become a large integer.) Care is taken to answer same hash as an equal Integer."</div><div><br></div><div><span class="gmail-Apple-tab-span" style="white-space:pre">        </span>(self isFinite and: [self fractionPart = 0.0]) ifTrue: [^self truncated hash].</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> </span>^ ((self basicAt: 1) bitShift: -4) +</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">   </span>   ((self basicAt: 2) bitShift: -4)</div><div><br></div><div>P.P.S. I *think* that "(self isFinite and: [self fractionPart = 0.0])" is equivalent to "self - self = self fractionPart" ;-)</div><div><br></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div>