<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2015-03-06 19:35 GMT+01:00 Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:ncellier@ifrance.com" target="_blank">ncellier@ifrance.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div>I&#39;m trying to understand the negative case...<br><br></div>We have the magnitude on one side xMag<br></div>We minSmallInteger in two complement on the other side yTC<br></div>We know that the magnitude of minSmallInteger is yMag=bitInvert(yTC)+1<br></div>We know that all bytes of yTC are 0 but the MSB<br></div>Thus all bytes of bitInvert(yTC) are 16rFF<br></div>Thus all bytes of yMag are 0, but the highest which is (MSB(yTC) xOr: 256) + 1.<br></div></div></div></div></div></div></div></blockquote><div><br></div><div>&lt;Blush&gt; it&#39;s xOr: 255 of course...&lt;/Blush&gt; <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><br></div>Thus, assuming same byte length:<br>MSB(xMag) &lt; MSB(yMag) =&gt; x is a CSI<br>MSB(xMag) &gt; MSB(yMag) =&gt; x is large<br>MSB(xMag) = MSB(yMag) =&gt; we must inquire the LSBs of xMag..<br></div>(1 to: len-1) anySatisfy: [:i | (xMag digitAt: i) ~= 0] =&gt; x isLarge<br></div>otherwise, x is minSmallInteger<br><br></div>Eliot, I fail to see the bitInvert(MSB(minSmallInteger))+1 in your code...<br></div>Did I miss something?<br><br></div>Nicolas<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-06 0:37 GMT+01:00 Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr">Hi Nicolas,<div><br></div><div>   I found my misunderstanding.  Can you review this version instead?</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 5, 2015 at 11:41 AM, Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Nicolas,<div><br></div><div>     would you mind also reviewing the attached changes?  There&#39;s a bug in them somewhere, although I think they&#39;re close to correct.  The ideas here are to</div><div><br></div><div>- avoid calling firstIndexableField: on every call to unsafeByteOf:at: in isNormalized:, normalizePositive: and normalizeNegative:.  Do this by cacheing firstIndexableField in a local pointer variable</div><div>- move the bounds check in cDigitOfCSI:at: out to clients that aren&#39;t invoking cDigitOfCSI:at: with in-bounds indices</div><div>- avoid the immediate test in digitLengthOf: when it is known that the object is non-immediate.  Do so by adding digitLengthOfNonImmediate:.</div><div><br></div><div>Of course this approach can be extended to other LargeIntegers methods, but one step at a time :-/</div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Wed, Mar 4, 2015 at 2:49 PM, Nicolas Cellier <span dir="ltr">&lt;<a href="mailto:nicolas.cellier.aka.nice@gmail.com" target="_blank">nicolas.cellier.aka.nice@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><div><div><br>sLen := interpreterProxy minSmallInteger &gt; 16r3FFFFFFF<br><br></div>sounds like a copy/paste error<br></div>I would expect maxSmallInteger here.<br></div>
<br></blockquote></div></div></div><span><font color="#888888"><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div>best,<div>Eliot</div></div>
</font></span></font></span></div><span class="HOEnZb"><font color="#888888">
</font></span></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div>best,<div>Eliot</div></div>
</font></span></div><span class="HOEnZb"><font color="#888888">
<br></font></span></blockquote></div><br></div>
</blockquote></div><br></div></div>