<div dir="ltr"><div>Note that some times ago, Andreas and Eliot have added primitives exploiting the ubiquitous possibility of performing 64 bits arithmetic in underlying C language with modern compilers.<br><br>So there is also InterpreterPrimitives&gt;&gt;#primitiveBitAndLargeIntegers which works for positive integer receiver and arguments up to 64 bits and is currently connected to primitive 34 in both Interpreter and COG VM.<br>
<br></div>So a possible strategy would be to invoke &lt;primitive: 34&gt; from LargePositiveInteger and fall back to super if failed. That may speed up some operations on &quot;Small&quot; large integers, and will add a bit more delay for &quot;Large&quot; and negative Large integers. Up to you to peek a sufficiently recent VM and test...<br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/6/21 Levente Uzonyi <span dir="ltr">&lt;<a href="mailto:leves@elte.hu" target="_blank">leves@elte.hu</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Thu, 20 Jun 2013, Ralph Boland wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I am using Squeak  3.11.  I assume the same results apply to Squeak 4.4.  If not, my apologies.<br>
</blockquote>
<br></div>
LargePositiveInteger &gt;&gt; #bitAnd: is not present in Squeak 4.4.<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
In Squeak if I evaluate:<br>
<br>
1)  ((2 &lt;&lt; 256)  bitAnd: (2 &lt;&lt; 128)) ==&gt;  0<br>
2)  ((2 &lt;&lt; 256)  bitAnd: (2 &lt;&lt; 128)) class ==&gt; SmallInteger<br>
3)  (2 &lt;&lt; 128)                               ==&gt;  680564733841876926926749214863<u></u>536422912<br>
4)  ((2 &lt;&lt; 128) bitAnd: (2 &lt;&lt; 128))  ==&gt;  680564733841876926926749214863<u></u>536422912<br>
<br>
This all looks correct and I care because I need to do &lt;bitAnd:&gt; of some largePositiveIntegers.<br>
<br>
But &lt;LargePositiveInteger&gt;&gt;BitAnd:<u></u>&gt;  is:<br>
<br>
&quot;Primitive. Answer an Integer whose bits are the logical AND of the<br>
    receiver&#39;s bits and those of the argument. Fail if the receiver or argument<br>
    is greater than 32 bits. See Object documentation whatIsAPrimitive.&quot;<br>
    &lt;primitive: 14&gt;<br>
    self halt.          &quot;I ADDED THE HALT&quot;<br>
    ^ super bitAnd: anInteger<br>
<br>
The way I see it  &lt;LargePositiveInteger&gt;&gt;BitAnd:<u></u>&gt;   is always going to fail and thus invoke its super version<br>
(&lt;LargePositiveInteger&gt;&gt;<u></u>BitAnd:&gt;)  and this is what I see when I run the code; i.e. I hit the halt.<br>
<br>
So why have &lt;LargePositiveInteger&gt;&gt;BitAnd:<u></u>&gt; method at all?<br>
</blockquote>
<br></div>
As the comment says: primitive 14 works for nonnegative SmallIntegers and all LargePositiveIntegers which can be represented in 4 bytes, so all values up to 4294967295.<br>
<br>
In your image the following expression should use the primitive:<br>
<br>
        4294967295 bitAnd: 1<br>
<br>
In this case the primitive should fail:<br>
<br>
        4294967296 bitAnd: 1<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Levente</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Ditto for the other bit operations.<br>
<br>
Ralph Boland<br>
<br>
</blockquote>
</div></div><br><br>
<br></blockquote></div><br></div>