[squeak-dev] The Trunk: Kernel-ul.604.mcz

Eliot Miranda eliot.miranda at gmail.com
Mon Jul 11 16:36:13 UTC 2011


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
> integers.
> 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.
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20110711/ebf30f40/attachment.htm


More information about the Squeak-dev mailing list