<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 25, 2017 at 3:53 PM, Bert Freudenberg <span dir="ltr"><<a href="mailto:bert@freudenbergs.de" target="_blank">bert@freudenbergs.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>What is the range of your LargeIntegers? SqueakJS does not implement most of prims 30-37,</div></div></div></div></blockquote><div><br></div><div>I meant 20 - 37, the large int arithmetic prims, of course</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div> whereas the C VM at least does so with up to 64 bits IIRC?</div><div><a href="https://github.com/bertfreudenberg/SqueakJS/blob/master/vm.js#L4301" target="_blank">https://github.com/<wbr>bertfreudenberg/SqueakJS/blob/<wbr>master/vm.js#L4301</a></div><div><br></div><div>This is just laziness on my part (since the fallback + plugin works), there's no good reason not to implement a fast path for these if the numbers fall within the 53 bit range JS can handle directly. We do have the code for 31 bit SmallInts, so this should be relatively simple.</div><div></div></div></div></div></blockquote></div><br></div><div class="gmail_extra">If someone wants to give this a shot, it should work along the lines of</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">case</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">21</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">: </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">return</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">this</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">.</span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">popNandPush53BitIntIfOK</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">(</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">2</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">,</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">this</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">.</span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">stackSigned53BitInt</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">(</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">1</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">) </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(167,29,93);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">+</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"> </span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">this</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">.</span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(121,93,163);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">stackSigned53BitInt</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">(</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(0,134,179);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">0</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">))</span><span style="color:rgb(51,51,51);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre">; </span><span class="gmail-pl-c" style="box-sizing:border-box;color:rgb(150,152,150);font-family:consolas,"liberation mono",menlo,courier,monospace;font-size:12px;white-space:pre"><span class="gmail-pl-c" style="box-sizing:border-box">//</span> primitiveAddLargeIntegers</span><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">similar to what is already there for prims 23-28. Don't forget to extend NonSmallInt so you can reuse vm.div / vm.mod.</div><div class="gmail_extra"><br></div><div class="gmail_extra">- Bert -</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>