Mention endianness and alignment in section ArrayBuffers, binary arrays
-
Alignment: My browser (Firefox 87.0 on Linux x86_64) doesn't let me create an unaligned Uint16Array. I. e.,
new Uint16Array(b, 1, 1)on a 4-byte array buffer givesRangeError: attempting to construct out-of-bounds TypedArray on ArrayBuffer. In the standard that is 22.2.1.5.13a. -
Endianness: Uint16Array is little-endian on my machine. I just learned that this is machine dependent (https://stackoverflow.com/questions/7869752/javascript-typed-arrays-and-endianness). In contrast,
dataView.getUint16()is big-endian, unless the second argument is true.
Hope this helps.
I guess, most readers don't know what an endian is. Not sure we need to delve into this.
Can we give a reference maybe?