initialize float4 (core.simd)
Bogdan
olar.bogdan.dev at gmail.com
Sat Sep 21 12:50:46 UTC 2019
I'm trying to understand how to use the `core.simd`
functionality, and I'm having trouble initializing a float4
vector.
Here's my example code:
```
import std.stdio;
import core.simd;
void main()
{
float[4] values = [1.0f, 2.0f, 3.0f, 4.0f];
float delta = 15.0f;
writeln(doSimd(values, delta));
}
float[4] doSimd(float[4] values, float delta)
{
float4 v_delta = delta;
float4 v_values = values;
// ... do SIMD ...
return [v_delta[0], v_delta[0],v_delta[0],v_delta[0]];
}
```
Compilation is failing with the following error:
```
source/app.d(16,21): Error: cannot implicitly convert expression
values of type float[4] to __vector(float[4])
dmd failed with exit code 1.
```
How do you initialize a float4 with some useful data?
More information about the Digitalmars-d-learn
mailing list