How to? DoubleArray

Andreas Raab andreas.raab at gmx.de
Fri Feb 10 00:49:11 UTC 2006


nicolas cellier wrote:
> Anyone implemented a DoubleArray ?

I thought about it but decided against it. Mainly because implementing 
runtime efficient operations (contrary to "just" space efficient 
storage) requires that a) the doubles are stored in host order  which is 
not supported by the VM (Squeak's Floats are always in MSB order which 
will soon prove a hilarious artifact of a long distance past when men 
were real men, women were real women, and big endian Macs were real big 
endian Macs) and b) various platforms require doubles to be 8-byte 
aligned (and Squeak only guarantees 4-byte alignment). Because of that, 
having double-arrays would only be useful for efficient storage but if 
you need efficient storage you might as well use FloatArrays which cut 
your storage requirements further in half.

> If not, how  to declare such a class ? byteArray, wordArray ?
> I did not see a doubleWordArray...

Because there is no such thing.

> How to convert one element to a Float and vice versa ?

You'll either have to write primitives to do the conversion or you'd 
have to construct the Float from two words.

> I did not see anything about endianness conversion. where is it ?
> Or Is squeak only for little endian machines ?

It's in the VM and deals exclusively with 32bit quantities.

Cheers,
   - Andreas



More information about the Squeak-dev mailing list