COMMUNITY

JS to Std convertion

Hi,
I want to convert this specific HaxeJS code to Std.

var dst:Int32Array;
var dstbytes = new Uint8Array( dst.buffer );

I do this

var dst:Int32Array;
var dstbytes:UInt8Array = UInt8Array.fromBytes( ArrayBufferView.fromData(cast dst).buffer );	

I can’t change dst and dstbytes types of course. So, is there something more efficient than that ?

Thanks

Can’t you do UInt8Array.fromBytes( dst.view.buffer ); to get rid of the cast?

1 Like

Much better :slight_smile: