[whatwg] Endianness of typed arrays
Mark Callow
callow_mark at hicorp.co.jp
Wed Mar 28 03:01:00 PDT 2012
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
More information about the whatwg
mailing list