Re: Fun with ArrayBuffers

Pernot Christian <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpfe
Message-ID <[email protected]>
Le 31/01/2012 22:30, Tony Cox a écrit :
> I'm hoping somebody can tell me where I am going wrong using typed array buffers. I am parsing a binary stream. Uint32 drop out very nicely using this function:
>
>    readUint32: function(stream) {
>       var u = new Uint8Array(stream.readByteArray(4));
>       return new Uint32Array(u.buffer)[0];
>     },
>
> But the equivalent for Float32 fails. I just cannot work out why....
>
>    readFloat32: function(stream) {
>       var u = new Uint8Array(stream.readByteArray(4));
>       return new FLOAT32Array(u.buffer)[0];
>     },
>
> Any help very gratefully received.

maybe respect the case :)
see : https://developer.mozilla.org/en/JavaScript_typed_arrays/Float32Array
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.