[squeak-dev] The Inbox: Kernel-ul.1411.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Fri Sep 10 14:05:43 UTC 2021


Hi Levente --

> removed Integer >> #isPowerOfTwo because it was not used: all subclasses implement that method

Hmm... what about removing the one in SmallInteger instead bc. its implementation is not that special. #strictlyPositive might be deprecated as well, looking at its 4 senders. Maybe just replace those few integer uses with "> 0" instead. 

Best,
Marcel
Am 10.09.2021 15:56:05 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Levente Uzonyi uploaded a new version of Kernel to project The Inbox:
http://source.squeak.org/inbox/Kernel-ul.1411.mcz

==================== Summary ====================

Name: Kernel-ul.1411
Author: ul
Time: 10 September 2021, 3:16:23.23175 pm
UUID: 9d7f74f9-52b9-4a1c-babf-60de439244bb
Ancestors: Kernel-ul.1409

- let all Numbers respond to #isPowerOfTwo.
- removed Integer >> #isPowerOfTwo because it was not used: all subclasses implement that method

=============== Diff against Kernel-ul.1409 ===============

Item was added:
+ ----- Method: Fraction>>isPowerOfTwo (in category 'testing') -----
+ isPowerOfTwo
+ "Return true if the receiver is an integral power of two."
+
+ ^numerator = 1 and: [ denominator isPowerOfTwo ]!

Item was removed:
- ----- Method: Integer>>isPowerOfTwo (in category 'testing') -----
- isPowerOfTwo
- "Return true if the receiver is an integral power of two."
-
- ^self strictlyPositive and: [ (self bitAnd: self - 1) = 0 ]!

Item was added:
+ ----- Method: Number>>isPowerOfTwo (in category 'testing') -----
+ isPowerOfTwo
+ "Return true if the receiver is an integral power of two."
+
+ self subclassResponsibility!

Item was added:
+ ----- Method: ScaledDecimal>>isPowerOfTwo (in category 'testing') -----
+ isPowerOfTwo
+ "Return true if the receiver is an integral power of two."
+
+ ^fraction isPowerOfTwo!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20210910/b95cc3fc/attachment.html>


More information about the Squeak-dev mailing list