(web) add asTypedList extension for Pointer<Float>/Float32List
This commit is contained in:
@@ -212,13 +212,16 @@ extension Float64ListExtension on Float64List {
|
|||||||
bar.toDart.setRange(0, length, this);
|
bar.toDart.setRange(0, length, this);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// static Float64List create(int length) {
|
extension AsFloat32List on Pointer<Float> {
|
||||||
// final ptr = malloc(length * 8);
|
Float32List asTypedList(int length) {
|
||||||
// final buffer = _NativeLibrary.instance._emscripten_make_f64_buffer(ptr.cast(), length).toDart;
|
final start = addr;
|
||||||
// _allocated.add(buffer);
|
final wrapper =
|
||||||
// return buffer;
|
Float32ArrayWrapper(NativeLibrary.instance.HEAPU8.buffer, start, length)
|
||||||
// }
|
as JSFloat32Array;
|
||||||
|
return wrapper.toDart;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int sizeOf<T extends NativeType>() {
|
int sizeOf<T extends NativeType>() {
|
||||||
|
|||||||
Reference in New Issue
Block a user