How to? DoubleArray
Andreas Raab
andreas.raab at gmx.de
Fri Feb 10 02:22:14 UTC 2006
Yoshiki Ohshima wrote:
>> I did not see anything about endianness conversion. where is it ?
>> Or Is squeak only for little endian machines ?
>
> Of course, it runs on both endianness. Look at the
> ShortIntegerArray, and other classes that implement
> #restoreEndianness.
Actually, it's better *not* to look at #restoreEndianness - it's a red
herring (and the name is wrong, too). The method doesn't really
"restore" anything; all it does is swapping (byte, short, word)
quantities if called on a little endian platform (in other words, it's
always a no-op on big-enders and will be broken if called "the wrong
number of times" on little-enders[*]). A better place to look at is
ShortIntegerArray and friends (see the class-side methods, in particular
#startUp) since they have to implement endianness conversion manually
for lack of VM support.
[*] Even the definition of "wrong number of times" depends on whether
the array in question was loaded in a big- or little-endian format, or
if it was internal to begin with. And of course, if you load a
little-endian array on a big-endian platform and expect
#restoreEndianness to fix that, it won't work either. Confused? Well, I
told you not to look there ;-)
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|