<div dir="ltr">Hi All,<div><br></div><div> I'm making good progress on 64-bit Spur in the Stack VM simulator. But I've just noticed an image-level issue which could be indicative of lots of 32-bit assumptions baked into the Squeal/Pharo/Newspeak systems.</div><div><br></div><div>SmallInteger>>digitAt: n <div><span class="" style="white-space:pre">        </span>"Answer the value of an indexable field in the receiver. LargePositiveInteger uses bytes of base two number, and each is a 'digit' base 256. Fail if the argument (the index) is not an Integer or is out of bounds."</div><div><span class="" style="white-space:pre">        </span>n>4 ifTrue: [^ 0].</div><div><span class="" style="white-space:pre">        </span>self < 0</div><div><span class="" style="white-space:pre">                </span>ifTrue: </div><div><span class="" style="white-space:pre">                        </span>[self = SmallInteger minVal ifTrue:</div><div><span class="" style="white-space:pre">                                </span>["Can't negate minVal -- treat specially"</div><div><span class="" style="white-space:pre">                                </span>^ #(0 0 0 64) at: n].</div><div><span class="" style="white-space:pre">                        </span>^ ((0-self) bitShift: (1-n)*8) bitAnd: 16rFF]</div><div><span class="" style="white-space:pre">                </span>ifFalse: [^ (self bitShift: (1-n)*8) bitAnd: 16rFF]</div><div><br></div><div>This assumes that SmallInteger is only ever 4 bytes, which is unacceptably wasteful for my approach to 64-bits. In 64-bit Spur, SmallIntegers are 61-bit 2's complement.</div><div><br></div><div>I'm raising this example at this point to see if the community might find similar issues and bring them to my attention.</div>-- <br><div class="gmail_signature">best,<div>Eliot</div></div>
</div></div>