VecF16.generate constructor

VecF16.generate(
  1. int length,
  2. double generator(
    1. int i
    )
)

Implementation

factory VecF16.generate(int length, double Function(int i) generator) {
  final pp = calloc<cvg.VecF16>()..ref.length = length;
  pp.ref.ptr = calloc<ffi.Uint16>(length);
  for (var i = 0; i < length; i++) {
    pp.ref.ptr[i] = generator(i).fp16;
  }
  return VecF16.fromPointer(pp);
}