[Vm-dev] float word order
John M McIntosh
johnmci at smalltalkconsulting.com
Sun Apr 19 18:08:14 UTC 2009
On 19-Apr-09, at 8:37 AM, David T. Lewis wrote:
>> The values in a FloatArray are 32-bit floats, packed into 64-bit
>> slots
> in the object memory. There are no endian issues to worry about. On
> both
> 32-bit and 64-bit object memories, the values are arranged in the
> order
> of an (int *) access. In other words, they are arrays of 32-bit values
> that just happen to be stuffed onto slots that the object memory
> thinks
> are 64-bit words.
Well that's not quite true, you have to be careful here because might
people move data in and out of
the FloatArray, but let's see..
MatrixTransform2x3>>at: index put: value
<primitive: 'primitiveAtPut' module: 'FloatArrayPlugin'>
value isFloat
ifTrue:[self basicAt: index put: value asIEEE32BitWord]
ifFalse:[self at: index put: value asFloat].
^value
CGPoint>>x: aValue
self unsignedLongAt: 1 put: aValue asFloat asIEEE32BitWord
bigEndian: SmalltalkImage current isBigEndian.
Ok, well the reverseBytesInImage logic I'll assume without looking is
swapping the bytes in the FloatArray at load time so that accessors
use SmalltalkImage current isBigEndian to move data in/out in the
proper form.
--
=
=
=
========================================================================
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd. http://www.smalltalkconsulting.com
=
=
=
========================================================================
More information about the Vm-dev
mailing list