ByteArray, wordAt/doubleWordAt

John.Maloney at disney.com John.Maloney at disney.com
Sat Oct 2 02:40:34 UTC 1999


Dino:

I believe that the messages you are referring to were actually
left over from the old 16-bit Xerox Smalltalk where "word" meant
16-bits! These days, the reader would expect "wordAt:" to mean
a 32-bit word and "doubleAt:" to mean a 64-bit quantity.

However, all of the functionality you need is still there.
Look in the category "platform independent access". Just translate:

  wordAt: -> shortAt:bigEndian:
  doubleAt: -> longAt:bigEndian:

and you'll be all set.

To ensure platform independence, these methods let you be explicit
about which byte ordering you want. In the case of ICQ, the byte
ordering will be a constant defined by the protocol spec, but these
methods can also be used to read binary data from OS data structures or
files which might have different byte orderings on different platforms.

Hope this helps.

	-- John



>What happened to ByteArray's messages in 2.5?  Why was there a decision to take
>out wordAt: and doubleWordAt:??  I use these very frequently in my ICQ
>program...  it would be best if they were still there.  (I stuck them back in my
>2.5 image...  can't do ICQ without them)
>
>Dino





More information about the Squeak-dev mailing list