<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">&lt;<a href="mailto:timfelgentreff@gmail.com" target="_blank">timfelgentreff@gmail.com</a>&gt;</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&#39;t careful here and got confused by the method name and comment,<br>
thinking we&#39;re talking platform integers here. I updated the method to<br>
truncate to 32-bit.<br>
<br></blockquote><div><br></div><div>That&#39;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 &gt;= -16r80000000 and: [self &lt;= 16r7FFFFFFF])<br>
+               ifTrue: [^self].<br><br></div><div>above code does imply large integers on those platforms.<br></div><div>I didn&#39;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>
&gt; On Thu, May 19, 2016 at 7:04 AM, Nicolas Cellier &lt;<br>
<br>
&gt; nicolas.cellier.aka.nice@<br>
<br>
&gt;&gt; wrote:<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; 2016-05-19 9:49 GMT+02:00 &amp;lt;<br>
<br>
&gt; commits@.squeak<br>
<br>
&gt; &amp;gt;:<br>
<div><div class="h5">&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Tim Felgentreff uploaded a new version of VMMaker to project VM Maker:<br>
&gt;&gt;&gt; <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>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; ==================== Summary ====================<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Name: VMMaker.oscog-tfel.1862<br>
&gt;&gt;&gt; Author: tfel<br>
&gt;&gt;&gt; Time: 19 May 2016, 9:49:06.672041 am<br>
&gt;&gt;&gt; UUID: ee2580a0-a9df-a945-ab7d-26865d302201<br>
&gt;&gt;&gt; Ancestors: VMMaker.oscog-tfel.1861<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Use SmallInteger maxVal and minVal in Integer&gt;&gt;signedIntFromLong for the<br>
&gt;&gt;&gt; benefit of VMs that can fit more than 30bit into a signed integer<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; =============== Diff against VMMaker.oscog-eem.1860 ===============<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Item was changed:<br>
&gt;&gt;&gt;   ----- Method: Integer&gt;&gt;signedIntFromLong (in category<br>
&gt;&gt;&gt; &#39;*VMMaker-interpreter simulator&#39;) -----<br>
&gt;&gt;&gt;   signedIntFromLong<br>
&gt;&gt;&gt;         &quot;Self is a signed or unsigned 32-bit integer&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;         | bits |<br>
&gt;&gt;&gt; +       (self &gt;= SmallInteger minVal and: [self &lt;= SmallInteger maxVal])<br>
&gt;&gt;&gt; ifTrue: &quot;These are known to be SmallIntegers...&quot;<br>
&gt;&gt;&gt; -       (self &gt;= -1073741824 and: [self &lt;= 1073741823]) ifTrue: &quot;These<br>
&gt;&gt;&gt; are known to be SmallIntegers...&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi Tim,<br>
&gt;&gt; this does not look correct to me.<br>
&gt;&gt; if maxVal is 1&lt;&lt;60-1, and self is 1&lt;&lt;40, then self won&#39;t be truncated to<br>
&gt;&gt; 32 low bits as it should...<br>
&gt;&gt;<br>
&gt;<br>
</div></div>&gt; +1.<br>
<span class="">&gt;<br>
&gt;<br>
&gt;&gt; Above test is just a fast-up.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;&gt;                 [^self].<br>
&gt;&gt;&gt;         bits := self bitAnd: 16rFFFFFFFF.<br>
&gt;&gt;&gt;         (bits digitAt: 4) &lt;= 16r7F ifTrue: [^bits].<br>
&gt;&gt;&gt;         ^bits - 16r100000000!<br>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
</span>&gt; _,,,^..^,,,_<br>
&gt; 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>