Ahh, yes - it's a bit annoying. The easiest way is to use the Typed Arrays... So:
var a = new Uint8Array(8); // 8 bytes
a.buffer // an 'untyped' buffer
new Int32Array(a.buffer); // a 2 element, int array
new Float32Array(a.buffer); // 2 element floating point array
new Float64Array(a.buffer); // 1 element float array
and so on... each of those arrays will act on the same data. You can also supply lengths and offsets
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Ahh, yes - it's a bit annoying. The easiest way is to use the Typed Arrays... So:
and so on... each of those arrays will act on the same data. You can also supply lengths and offsets