SmallInteger and machine word size

Klaus D. Witzel klaus.witzel at cobss.com
Tue Feb 19 14:29:32 UTC 2008


On Tue, 19 Feb 2008 14:13:09 +0100, 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?

These are the requirements addressed by class InterpreterSimulator (and  
its superclass and subclasses) when it saves+restores its .image; you have  
the solutions in the VMMaker package.

/Klaus

> 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?
>
>





More information about the Squeak-dev mailing list