help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] Creating binary data


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] Creating binary data
Date: Wed, 2 Jun 2010 08:59:55 +0200

On Wed, Jun 2, 2010 at 07:17, Holger Hans Peter Freyther
<address@hidden> wrote:
> Hi All,
>
> for the stuff I am planing to use GNU Smalltalk for I will need to
> create binary structures. This means I need to write numbers and similar
> as uint8,16,32,64, control the endian of these numbers and such. In
> Pharo I have found the DataStream class is there something like this in
> GNU Smalltalk? How would I solve my usecase in GNU Smalltalk?

For native endianness you can create a CStruct subclass and remember
to instantiate it with #gcNew instead of #new.

For specific endianness it is probably best to enhance the primitives
that access CObjects so that they take care of changing endianness.
This would be similar overall to how CArray/CPtr work (i.e. wrap the
original CObject) but of course the field type would still be scalar.

The simplest thing to do is of course to use CStruct and do the
endianness conversion yourself.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]