<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-02 13:27 GMT+02:00 David T. Lewis <span dir="ltr"><<a href="mailto:lewis@mail.msen.com" target="_blank">lewis@mail.msen.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div><br>
On Wed, Jul 02, 2014 at 07:44:26AM +0200, Nicolas Cellier wrote:<br>
><br>
> 2014-07-02 0:28 GMT+02:00 David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>>:<br>
><br>
> ><br>
> > On Tue, Jul 01, 2014 at 09:21:00PM +0200, Nicolas Cellier wrote:<br>
> > ><br>
> > > 2014-07-01 4:22 GMT+02:00 <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>>:<br>
> > ><br>
> > > ><br>
> > > > Item was changed:<br>
> > > > ----- Method: LargeIntegersPlugin>>cDigitSub:len:with:len:into: (in<br>
> > > > category 'C core') -----<br>
> > > > + cDigitSub: pByteSmall len: smallLen with: pByteLarge len: largeLen<br>
> > into:<br>
> > > > pByteRes<br>
> > > > + | z |<br>
> > > > - cDigitSub: pByteSmall<br>
> > > > - len: smallLen<br>
> > > > - with: pByteLarge<br>
> > > > - len: largeLen<br>
> > > > - into: pByteRes<br>
> > > > - | z limit |<br>
> > > > <var: #pByteSmall type: 'unsigned char * '><br>
> > > > <var: #pByteLarge type: 'unsigned char * '><br>
> > > > <var: #pByteRes type: 'unsigned char * '><br>
> > > ><br>
> > > > + z := 0. "Loop invariant is -1<=z<=1"<br>
> > > > + 0 to: smallLen - 1 do:<br>
> > > > - z := 0.<br>
> > > > - "Loop invariant is -1<=z<=1"<br>
> > > > - limit := smallLen - 1.<br>
> > > > - 0 to: limit do:<br>
> > > > [:i |<br>
> > > > z := z + (pByteLarge at: i) - (pByteSmall at: i).<br>
> > > > + pByteRes at: i put: z - (z // 256 * 256).<br>
> > "sign-tolerant<br>
> > > > form of (z bitAnd: 255)"<br>
> > > ><br>
> > ><br>
> > > Frankly, having z declared unsigned int and just doing pByteRes at: i<br>
> > put:<br>
> > > (z bitAnd: 16rFF) as I suggested would be way way simpler and will ALWAYS<br>
> > > work.<br>
> > > Why the hell invoke the complications of signed arithmetic when the<br>
> > content<br>
> > > pByteRes is unsigned???<br>
> ><br>
> > 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>
> ><br>
> Hi David,<br>
> that's interesting. VMMaker-nice.342 contains all the 32bits LargeInteger<br>
> modifications, not just the #cDigitSub:len:with:len:into:.<br>
> I tried to declare everything as <unsigned int> rather than <usqInt> with<br>
> the assumption that sizeof(unsigned int)*2==sizeof(unsigned long long).<br>
> But I never tried to compile a 64 bits VM, I think I lost the recipe for<br>
> brewing such a flavour.<br>
> I'm on MacOSX, could you provide a link to the shortest way to do it?<br>
> Once I can check it, I'll publish a corrected version.<br>
> Thanks<br>
<br></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
</div></div>Hi Nicolas,<br>
<br>
Starting with an up to date VMMaker (trunk), I loaded #cDigitSub:len:with:len:into:<br>
from VMMaker-nice.342, then compiled the VM on 64-bit Linux and ran the unit tests.<br>
<br></blockquote><div><br></div><div>Ah, but you can't pick this single method from LargeIntegerPlugin v2.0...<br>It tries to access/process by 32-bits digits instead of 8-bits digits.<br></div><div>So it would be necessary to also change the send site for providing the right number of digits...<br>
</div><div>I'll do a rewrite for 8 bits this evening...<br></div><div> <br></div><div>Nicolas<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I also ran tests on the 64-bit image with 64-bit VM, and this did *not* show<br>
any problem.<br>
<br>
Sorry I did not look into it further, I will try to do so as soon as I get<br>
some time.<br>
<br>
Dave<br>
<br>
</blockquote></div><br></div></div>