SmallInteger and machine word size

Igor Stasenko siguctua at gmail.com
Tue Feb 19 14:12:35 UTC 2008


On 19/02/2008, Bert Freudenberg <bert at freudenbergs.de> wrote:
>
> On Feb 19, 2008, at 14:13 , Igor Stasenko wrote:
>
> > Hello,
> >
> > I want to use integer values to pass them over a binary data stream.
> > And for this i need to encode a smallinteger value into bytearray
> > (endianess not matters).
> > Is there any way how to do it in platform independent way?
> > Lets say, if we have a SmallInteger>>asByteArray
> > then it should return an array of 4 bytes on 32 bit architecture and 8
> > bytes on 64 bits.
> >
> > Or maybe, as variant, can i convert somehow Smallinteger to Big one,
> > without make it auto-converted back to SmallInteger?
>
> What do you need this for? Why do you care if it is a SmallInteger?
> Doesn't #int32: do what you want?
>
No. I need a proper way how to transfer integer values (no matter if
they is small or big).
I think i found solution, which makes my code platform independent.



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list