<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Christoph,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Sep 7, 2021 at 2:54 PM <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">A new version of Kernel was added to project The Inbox:<br>
<a href="http://source.squeak.org/inbox/Kernel-ct.1412.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/inbox/Kernel-ct.1412.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: Kernel-ct.1412<br>
Author: ct<br>
Time: 7 September 2021, 11:54:32.77151 pm<br>
UUID: ca064a0e-13a5-f64f-ac9e-91ae045569a7<br>
Ancestors: Kernel-eem.1408<br>
<br>
Adds non-performant but existing implementation of #isPowerOfTwo on Number. Now 16s isPowerOfTwo works as expected, too. Complements Kernel-nice.1377.<br>
<br>
=============== Diff against Kernel-eem.1408 ===============<br>
<br>
Item was added:<br>
+ ----- Method: Number>>isPowerOfTwo (in category 'testing') -----<br>
+ isPowerOfTwo<br>
+ <br>
+       ^ self strictlyPositive and: [(self log2 \\ 1) isZero]!<br></blockquote><div><br></div><div class="gmail_default" style="font-size:small">If you care, fractionPart is about 6 times faster than \\ 1:</div><div class="gmail_default" style="font-size:small"><br></div>[4.0 fractionPart] bench '70,000,000 per second. 14.3 nanoseconds per run. 0 % GC time.' <br><div class="gmail_default" style="font-size:small">[4.0 \\ 1] bench '10,300,000 per second. 97.2 nanoseconds per run. 0 % GC time.'</div></div><div><br></div><div><div class="gmail_default" style="font-size:small">log2 always answers a float, and all scalar numbers respond to fractionPart.</div><br></div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div></div>