« Return to Thread: Fun with ArrayBuffers

Re: Fun with ArrayBuffers

by christian (Bugzilla)-4 :: Rate this Message:

| View in Thread

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
_______________________________________________
dev-tech-xul mailing list
dev-tech-xul@...
https://lists.mozilla.org/listinfo/dev-tech-xul

 « Return to Thread: Fun with ArrayBuffers