ByteArray positioning problem...

Dino gte949e at prism.gatech.edu
Tue Apr 13 07:17:45 UTC 1999


It seems like squeak does some kind of automatic byte aligning or something. 
When I try to do:

myByteArray wordAt: 2 put: 01.
This is what myByteArray looks like:  (Ignore the other odd stuff, focus on the
position of 01)
00 00 01 0E 00 00 00 00 00 01 00 00 00 00 00 00 00 00 68 65 6C 6C 6F 05 00 

When I do this:
myByteArray wordAt: 3 put: 01.
This is what myByte array looks like:
00 00 00 00 01 0E 00 00 00 01 00 00 00 00 00 00 00 00 68 65 6C 6C 6F 05 00

I thought when I specified wordAt: 2, it seemed like it worked.  it put 00 01
into myByteArray starting from position 2.  But when I tried wordAt: 3, it looks
like it put 00 01 starting from position 4.... what's the deal here?  Is it auto
aligning my bytes here?  I don't want this to happen.  Does this mean I'll have
to use two byteAt: messages to replace the wordAt: message?

please comment on this....

-- Dino





More information about the Squeak-dev mailing list