|
@@ -22,6 +22,8 @@
|
|
package js.html.compat;
|
|
package js.html.compat;
|
|
|
|
|
|
#if !nodejs
|
|
#if !nodejs
|
|
|
|
+import js.Lib.nativeThis;
|
|
|
|
+
|
|
@:keep
|
|
@:keep
|
|
class Float32Array {
|
|
class Float32Array {
|
|
|
|
|
|
@@ -45,7 +47,7 @@ class Float32Array {
|
|
arr = [];
|
|
arr = [];
|
|
// decode buffer
|
|
// decode buffer
|
|
for( i in 0...length ) {
|
|
for( i in 0...length ) {
|
|
- var val = untyped buffer.a[offset++] | (buffer.a[offset++] << 8) | (buffer.a[offset++] << 16) | (buffer.a[offset++] << 24);
|
|
|
|
|
|
+ var val = untyped buffer.a[offset++] | (buffer.a[offset++] << 8) | (buffer.a[offset++] << 16) | (buffer.a[offset++] << 24);
|
|
arr.push(haxe.io.FPHelper.i32ToFloat(val));
|
|
arr.push(haxe.io.FPHelper.i32ToFloat(val));
|
|
}
|
|
}
|
|
untyped {
|
|
untyped {
|
|
@@ -79,26 +81,24 @@ class Float32Array {
|
|
}
|
|
}
|
|
|
|
|
|
static function _set( ?arg : Dynamic, ?offset : Int ) {
|
|
static function _set( ?arg : Dynamic, ?offset : Int ) {
|
|
- var t : Dynamic = untyped __js__("this");
|
|
|
|
if( Std.is(arg.buffer,ArrayBuffer) ) {
|
|
if( Std.is(arg.buffer,ArrayBuffer) ) {
|
|
var a : Array<Int> = arg;
|
|
var a : Array<Int> = arg;
|
|
- if( arg.byteLength + offset > t.byteLength )
|
|
|
|
|
|
+ if( arg.byteLength + offset > nativeThis.byteLength )
|
|
throw "set() outside of range";
|
|
throw "set() outside of range";
|
|
for( i in 0...arg.byteLength )
|
|
for( i in 0...arg.byteLength )
|
|
- t[i + offset] = a[i];
|
|
|
|
|
|
+ nativeThis[i + offset] = a[i];
|
|
} else if( Std.is(arg,Array) ) {
|
|
} else if( Std.is(arg,Array) ) {
|
|
var a : Array<Int> = arg;
|
|
var a : Array<Int> = arg;
|
|
- if( a.length + offset > t.byteLength )
|
|
|
|
|
|
+ if( a.length + offset > nativeThis.byteLength )
|
|
throw "set() outside of range";
|
|
throw "set() outside of range";
|
|
for( i in 0...a.length )
|
|
for( i in 0...a.length )
|
|
- t[i + offset] = a[i];
|
|
|
|
|
|
+ nativeThis[i + offset] = a[i];
|
|
} else
|
|
} else
|
|
throw "TODO";
|
|
throw "TODO";
|
|
}
|
|
}
|
|
|
|
|
|
static function _subarray( start : Int, ?end : Int ) {
|
|
static function _subarray( start : Int, ?end : Int ) {
|
|
- var t : Dynamic = untyped __js__("this");
|
|
|
|
- var a = _new(t.slice(start,end));
|
|
|
|
|
|
+ var a = _new(nativeThis.slice(start,end));
|
|
a.byteOffset = start * 4;
|
|
a.byteOffset = start * 4;
|
|
return a;
|
|
return a;
|
|
}
|
|
}
|