SmallInteger and machine word size

Bert Freudenberg bert at freudenbergs.de
Tue Feb 19 13:31:08 UTC 2008


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?

- Bert -





More information about the Squeak-dev mailing list