W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2012

[whatwg] Endianness of typed arrays

From: Mark Callow <callow_mark@hicorp.co.jp>
Date: Wed, 28 Mar 2012 19:01:00 +0900
Message-ID: <4F72E15C.5060309@hicorp.co.jp>


On 28/03/2012 18:45, Boris Zbarsky wrote:
> On 3/28/12 2:40 AM, Mark Callow wrote:
>>
>> Because you said "JS-visible state (will) always be little-endian".
>
> So?  I don't see the problem, but maybe I'm missing something...
>
> The proposal is that if you take an array buffer, treat it as a
> Uint32Array, and write an integer of the form W | (X << 8) | (Y << 16)
> | (Z << 24) into it (where W, X, Y, Z are numbers in the range
> [0,255]), then the byte pattern in the buffer ends up being WXYZ, no
> matter what native endianness is.
>
> Reading the first integer from the Uint32Array view of this data would
> then return exactly the integer you started with...

So now you are saying that only the JS-visible state of ArrayBuffer is
little-endian. The JS-visible state of int32Array, etc. is in
platform-endiannesss. I took your original statement to mean that all
JS-visible state from TypedArrays is little-endian.

Regards

    -Mark
Received on Wednesday, 28 March 2012 03:01:00 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:40 UTC