<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-02 0:28 GMT+02:00 David T. Lewis <span dir="ltr">&lt;<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.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"><div class=""><div class="h5"><br>
On Tue, Jul 01, 2014 at 09:21:00PM +0200, Nicolas Cellier wrote:<br>
&gt;<br>
&gt; 2014-07-01 4:22 GMT+02:00 &lt;<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>&gt;:<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; Item was changed:<br>
&gt; &gt;   ----- Method: LargeIntegersPlugin&gt;&gt;cDigitSub:len:with:len:into: (in<br>
&gt; &gt; category &#39;C core&#39;) -----<br>
&gt; &gt; + cDigitSub: pByteSmall len: smallLen with: pByteLarge len: largeLen into:<br>
&gt; &gt; pByteRes<br>
&gt; &gt; +       | z |<br>
&gt; &gt; - cDigitSub: pByteSmall<br>
&gt; &gt; -               len: smallLen<br>
&gt; &gt; -               with: pByteLarge<br>
&gt; &gt; -               len: largeLen<br>
&gt; &gt; -               into: pByteRes<br>
&gt; &gt; -       | z limit |<br>
&gt; &gt;         &lt;var: #pByteSmall type: &#39;unsigned char * &#39;&gt;<br>
&gt; &gt;         &lt;var: #pByteLarge type: &#39;unsigned char * &#39;&gt;<br>
&gt; &gt;         &lt;var: #pByteRes type: &#39;unsigned char * &#39;&gt;<br>
&gt; &gt;<br>
&gt; &gt; +       z := 0. &quot;Loop invariant is -1&lt;=z&lt;=1&quot;<br>
&gt; &gt; +       0 to: smallLen - 1 do:<br>
&gt; &gt; -       z := 0.<br>
&gt; &gt; -       &quot;Loop invariant is -1&lt;=z&lt;=1&quot;<br>
&gt; &gt; -       limit := smallLen - 1.<br>
&gt; &gt; -       0 to: limit do:<br>
&gt; &gt;                 [:i |<br>
&gt; &gt;                 z := z + (pByteLarge at: i) - (pByteSmall at: i).<br>
&gt; &gt; +               pByteRes at: i put: z - (z // 256 * 256). &quot;sign-tolerant<br>
&gt; &gt; form of (z bitAnd: 255)&quot;<br>
&gt; &gt;<br>
&gt;<br>
&gt; Frankly, having z declared unsigned int and just doing  pByteRes at: i put:<br>
&gt; (z bitAnd: 16rFF) as I suggested would be way way simpler and will ALWAYS<br>
&gt; work.<br>
&gt; Why the hell invoke the complications of signed arithmetic when the content<br>
&gt; pByteRes is unsigned???<br>
<br>
</div></div>Nicolas,<br>
<br>
This sounds right to me.<br>
<br>
Do you have a final version of #cDigitSub:len:with:len:into: that you can<br>
recommend? The version in VMMaker-nice.342 produces failures in the<br>
KernelTests-Numbers tests when compiled in 64-bit mode, but I think that<br>
you have since suggested some other improvements in this email thread.<br>
<br>
Dave<br>
<br>
</blockquote></div><br></div><div class="gmail_extra">Hi David,<br></div><div class="gmail_extra">that&#39;s interesting. VMMaker-nice.342 contains all the 32bits LargeInteger modifications, not just the #cDigitSub:len:with:len:into:.<br>
</div><div class="gmail_extra">I tried to declare everything as &lt;unsigned int&gt; rather than &lt;usqInt&gt; with the assumption that sizeof(unsigned int)*2==sizeof(unsigned long long).<br></div><div class="gmail_extra">
But I never tried to compile a 64 bits VM, I think I lost the recipe for brewing such a flavour.<br></div><div class="gmail_extra">I&#39;m on MacOSX, could you provide a link to the shortest way to do it?<br></div><div class="gmail_extra">
Once I can check it, I&#39;ll publish a corrected version.<br></div><div class="gmail_extra">Thanks<br><br></div><div class="gmail_extra">Nicolas<br></div></div>