[whatwg] Endianness of typed arrays

Jonas Sicking jonas at sicking.cc
Wed Mar 28 02:04:43 PDT 2012

On Wed, Mar 28, 2012 at 1:03 AM, Robert O'Callahan <robert at ocallahan.org> wrote:
> On Wed, Mar 28, 2012 at 8:59 PM, Charles Pritchard <chuck at jumis.com> wrote:
>> I consider your position one of benevolent paternalism. You are free to
>> stick with it, and to apply it in your patch submissions.
>> I've no desire to coddle low-level coders. They know what they're getting
>> into.
> I'm not sure what you're getting at. I'm not making value judgements, just
> observing "Web browsers on big-endian machines will have to pretend to be
> little-endian as far as Web pages can observe" in order to be compatible
> with Web content, and suggesting that we may as well write specs in light of
> this fact.

Actually, the situation is somewhat worse.

Consider a big-endian platform where both the CPU and the GPU is
big-endian. If a webpage writes 16bit data into an ArrayBuffer and
then sends that off to the GPU using WebGL, the data had better be
sent in big-endian otherwise the GPU will interpret it wrong.

However if the same page then writes some 16bit data into an
ArrayBuffer and then looks at its individual bytes or send it across
the network to a server, it's very likely that the data needs to
appear as little-endian or site logic might break.

Basically I don't know how one would write a modern browser on a
big-endian system.

/ Jonas

More information about the whatwg mailing list