[squeak-dev] The Trunk: Kernel-ul.604.mcz
nicolas.cellier.aka.nice at gmail.com
Mon Jul 11 18:19:17 UTC 2011
I know some of them:
(Integer new: 5 neg: true) class.
(SmallInteger maxVal + 1 replaceFrom: 4 to: 4 with: # startingAt: 1)
(SmallInteger maxVal + 1 digitDiv: 4 neg: false) first class.
(SmallInteger maxVal + 1 \\\ 3) class.
And probably a few others (digitRshift:bytes:lookfirst:).
IMO, it's the responsibility of senders to normalize, and we should clearly
indicate the comment of each of these messages.
I also think that the last one, \\\, should send normalize, because it won't
change performance of senders noticeably.
2011/7/11 Eliot Miranda <eliot.miranda at gmail.com>
> Hi Igor,
> On Mon, Jul 11, 2011 at 4:30 AM, Igor Stasenko <siguctua at gmail.com> wrote:
>> Levente, your change is a bit dangerous,
>> because if i remember correctly, not all primitives normalizing large
>> So, it is fairly possible to have large integer with value in a range
>> of small integer.
> It is difficult to construct such a beast. If one uses the
> interpreterProxy API, positive32BitIntegerFor et al you'll always obtain
> something normalized. AFAIA, the only way one can create something
> unnormalized is by asking for a large integer and then altering its
> contents. So for me this isn't a dangerous change and requiring VM code to
> always deal with normalized integers seems rational and dependable to me.
>> Not saying , that one can manipulate largeinteger bits directly, and
>> then use it later in comparison,
>> which will fail due to your changes.
>> So, such change requiring strong guarantees that you cannot create
>> large integers which is in range of small integers.
>> On 10 July 2011 16:36, <commits at source.squeak.org> wrote:
>> > Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
>> > http://source.squeak.org/trunk/Kernel-ul.604.mcz
>> > ==================== Summary ====================
>> > Name: Kernel-ul.604
>> > Author: ul
>> > Time: 10 July 2011, 4:36:20.467 pm
>> > UUID: f758876f-a507-404b-aa2f-2c1038504b48
>> > Ancestors: Kernel-bf.603
>> > Optimized Integer >> #= for integer-integer comparisons. Return false
>> for integers from different classes without further checking.
>> > =============== Diff against Kernel-bf.603 ===============
>> > Item was changed:
>> > ----- Method: Integer>>= (in category 'comparing') -----
>> > = aNumber
>> > +
>> > + aNumber isInteger ifTrue: [
>> > + aNumber class == self class ifFalse: [ ^false ].
>> > + ^(self digitCompare: aNumber) = 0 ].
>> > + aNumber isNumber ifFalse: [ ^false ].
>> > + ^aNumber adaptToInteger: self andCompare: #=!
>> > - aNumber isNumber ifFalse: [^ false].
>> > - aNumber isInteger ifTrue:
>> > - [aNumber negative == self negative
>> > - ifTrue: [^ (self digitCompare: aNumber) = 0]
>> > - ifFalse: [^ false]].
>> > - ^ aNumber adaptToInteger: self andCompare: #=!
>> Best regards,
>> Igor Stasenko AKA sig.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev