Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize const float32x4x4_t (ARM NEON intrinsic, GCC)?

I can initialize float32x4_t like this:

const float32x4x4_t zero = { 0.0f, 0.0f, 0.0f, 0.0f };

But this code makes an error Incompatible types in initializer:

const float32x4x4_t one =
{
    1.0f, 1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f, 1.0f,
    1.0f, 1.0f, 1.0f, 1.0f,
};

float32x4x4_t is 4x4 matrix built as:

typedef struct float32x4x4_t
{
    float32x4_t val[4];
}
float32x4x4_t;

How can I initialize this const struct?

like image 748
eonil Avatar asked May 01 '10 12:05

eonil


1 Answers

const float32x4x4_t nameOfVariableHere =
{{
    {1.0f, 1.0f, 1.0f, 1.0f},
    {1.0f, 1.0f, 1.0f, 1.0f},
    {1.0f, 1.0f, 1.0f, 1.0f},
    {1.0f, 1.0f, 1.0f, 1.0f}
}};

The 1st level of parenthesis is for the struct.
The 2nd level is for the array of float32x4_t.
The 3rd level is for float32x4_t itself.

like image 194
kennytm Avatar answered Oct 28 '22 23:10

kennytm