forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
29
Kha/Sources/kha/arrays/Float32Array.hx
Normal file
29
Kha/Sources/kha/arrays/Float32Array.hx
Normal file
@ -0,0 +1,29 @@
|
||||
package kha.arrays;
|
||||
|
||||
@:forward
|
||||
abstract Float32Array(ByteArray) from ByteArray to ByteArray {
|
||||
public var length(get, never): Int;
|
||||
|
||||
inline function get_length(): Int {
|
||||
return this.byteLength >> 2;
|
||||
}
|
||||
|
||||
public function new(elements: Int) {
|
||||
this = ByteArray.make(elements * 4);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function get(k: Int): FastFloat {
|
||||
return this.getFloat32(k * 4);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function set(k: Int, v: FastFloat): FastFloat {
|
||||
this.setFloat32(k * 4, v);
|
||||
return v;
|
||||
}
|
||||
|
||||
public inline function subarray(start: Int, ?end: Int): Float32Array {
|
||||
return this.subarray(start * 4, end != null ? end * 4 : end);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user