<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-05-20 13:17 GMT+02:00 timfelgentreff <span dir="ltr"><<a href="mailto:timfelgentreff@gmail.com" target="_blank">timfelgentreff@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Sorry, I wasn't careful here and got confused by the method name and comment,<br>
thinking we're talking platform integers here. I updated the method to<br>
truncate to 32-bit.<br>
<br></blockquote><div><br></div><div>That's why I like having diffs in mailing lists :)<br></div><div>Note that your new code is correct, and the intention might be clearer than original code.<br>But it removed the SmallInteger optimization if the host image is 32bits...<br><br>
+ (self >= -16r80000000 and: [self <= 16r7FFFFFFF])<br>
+ ifTrue: [^self].<br><br></div><div>above code does imply large integers on those platforms.<br></div><div>I didn't measure if it really has an impact on simulation, maybe not, but this should be verified first.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Eliot Miranda-2 wrote<br>
> On Thu, May 19, 2016 at 7:04 AM, Nicolas Cellier <<br>
<br>
> nicolas.cellier.aka.nice@<br>
<br>
>> wrote:<br>
><br>
>><br>
>><br>
>><br>
>> 2016-05-19 9:49 GMT+02:00 &lt;<br>
<br>
> commits@.squeak<br>
<br>
> &gt;:<br>
<div><div class="h5">>><br>
>>><br>
>>> Tim Felgentreff uploaded a new version of VMMaker to project VM Maker:<br>
>>> <a href="http://source.squeak.org/VMMaker/VMMaker.oscog-tfel.1862.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-tfel.1862.mcz</a><br>
>>><br>
>>> ==================== Summary ====================<br>
>>><br>
>>> Name: VMMaker.oscog-tfel.1862<br>
>>> Author: tfel<br>
>>> Time: 19 May 2016, 9:49:06.672041 am<br>
>>> UUID: ee2580a0-a9df-a945-ab7d-26865d302201<br>
>>> Ancestors: VMMaker.oscog-tfel.1861<br>
>>><br>
>>> Use SmallInteger maxVal and minVal in Integer>>signedIntFromLong for the<br>
>>> benefit of VMs that can fit more than 30bit into a signed integer<br>
>>><br>
>>> =============== Diff against VMMaker.oscog-eem.1860 ===============<br>
>>><br>
>>> Item was changed:<br>
>>> ----- Method: Integer>>signedIntFromLong (in category<br>
>>> '*VMMaker-interpreter simulator') -----<br>
>>> signedIntFromLong<br>
>>> "Self is a signed or unsigned 32-bit integer"<br>
>>><br>
>>> | bits |<br>
>>> + (self >= SmallInteger minVal and: [self <= SmallInteger maxVal])<br>
>>> ifTrue: "These are known to be SmallIntegers..."<br>
>>> - (self >= -1073741824 and: [self <= 1073741823]) ifTrue: "These<br>
>>> are known to be SmallIntegers..."<br>
>>><br>
>><br>
>> Hi Tim,<br>
>> this does not look correct to me.<br>
>> if maxVal is 1<<60-1, and self is 1<<40, then self won't be truncated to<br>
>> 32 low bits as it should...<br>
>><br>
><br>
</div></div>> +1.<br>
<span class="">><br>
><br>
>> Above test is just a fast-up.<br>
>><br>
>><br>
>>> [^self].<br>
>>> bits := self bitAnd: 16rFFFFFFFF.<br>
>>> (bits digitAt: 4) <= 16r7F ifTrue: [^bits].<br>
>>> ^bits - 16r100000000!<br>
>>><br>
>><br>
</span>> _,,,^..^,,,_<br>
> best, Eliot<br>
<br>
<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://forum.world.st/VM-Maker-VMMaker-oscog-tfel-1862-mcz-tp4895935p4896329.html" rel="noreferrer" target="_blank">http://forum.world.st/VM-Maker-VMMaker-oscog-tfel-1862-mcz-tp4895935p4896329.html</a><br>
Sent from the Squeak VM mailing list archive at Nabble.com.<br>
</blockquote></div><br></div></div>