concat method

FVector concat(
  1. FVector other
)

concatenate two vectors (immutable)

Implementation

FVector concat(FVector other) {
  Float32x4List newColumnData = Float32x4List((nRows + other.nRows + 3) ~/ 4);
  int i;
  for (i = 0; i < columnData.length; ++i) newColumnData[i] = columnData[i];

  if (nRows % 4 == 0) {
    for (int j = 0; j < other.columnData.length; ++j, ++i) {
      newColumnData[i] = other.columnData[j];
    }
  } else {
    if (nRows % 2 == 0) {
      var intView = newColumnData.buffer.asInt64List(nRows * 4);
      var otherSrcView = other.columnData.buffer.asInt64List();
      for (i = 0; i < otherSrcView.length; ++i) intView[i] = otherSrcView[i];
    } else {
      var intView = newColumnData.buffer.asInt32List(nRows * 4);
      var otherSrcView = other.columnData.buffer.asInt32List();
      for (i = 0; i < otherSrcView.length; ++i) intView[i] = otherSrcView[i];
    }
  }
  return FVector.fromBuffer(nRows + other.nRows, newColumnData);
}