Supposedly I have either an int[] array or Vector256<int>s. How can I copy the values from one to another using an array index?
At the moment I have to iterate over the array indices and copy the values one by one:
int[] input = ...; // length divisible by Vector256<int>.Count
int[] output = new int[intput.Length];
for (int i = 0; i < input.Length; i += Vector256<int>.Count)
{
Vector256<int> v = Vector256.Create(
array[i], array[i + 1], array[i + 2], array[i + 3],
array[i + 4], array[i + 5], array[i + 6], array[i + 7]);
Vector256<int> v2 = DoSomeWork(v);
for (int j = 0; j < Vector256<int>.Count; ++j)
{
output[i + j] = v2.GetElement(i + j);
}
}
In Java SDK 16, there are functions that can do exactly what I need. Is there any similar function in C#?
int[] input = ...;
int[] output = new int[values.length];
for (int i = 0; i < input.length; i += IntVector.SPECIES_256.length()) {
IntVector v = IntVector.fromArray(IntVector.SPECIES_256, input, i);
IntVector v2 = DoSomeWork(v);
v2.intoArray(output, i);
}