[Vm-dev] positive32BitValueOf: fail with LargePositiveInteger

David T. Lewis lewis at mail.msen.com
Sun Oct 10 13:25:26 UTC 2010


On Sun, Oct 10, 2010 at 03:24:35AM +0200, Levente Uzonyi wrote:
> 
> On Fri, 8 Oct 2010, David T. Lewis wrote:
> 
> >
> >On Fri, Oct 08, 2010 at 07:12:13PM +0200, Mariano Martinez Peck wrote:
> >>
> >>So....I don't understand...how can I have a LargePositiveInteger but that 
> >>is
> >>less than 32 bits?  Wouldn't that  be a SmallInteger?
> >
> >SmallInteger maxVal hex ==> '16r3FFFFFFF'.
> >
> >The largest positive two-compliment integer that fits into 32 bits is
> >16rEFFFFFFF, so any Integer in the range 16r4000000 through 16rEFFFFFFF
> >is a LargePositiveInteger that can fit into a signed 32-bit C int.
> >
> >Thus the number of LargePositiveInteger values that fit into a 32-bit
> >twos-compliment representation is (16r4000000 to: 16rEFFFFFFF) size ==> 
> >3959422976
> >
> >Note that a SmallInteger is represented internally as a 31-bit value,
> >which accounts for the difference. It's a bit confusing when you are used
> >to thinking of 32-bit int values.
> 
> Shouldn't those 16rEFFFFFFF's be 167FFFFFF?
> 
> Levente

Umm, yes of course. Sorry about that.

Dave

 


More information about the Vm-dev mailing list