views:

232

answers:

1

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?

+1  A: 
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.

KennyTM
Oh my God! I omitted variable name! Sorry for this. I updated my question. And this way makes "error: incompatible types in initialization", "error: extra brace group at end of initializer". Thanks.
Eonil
@Eonil: Sorry, I've left the extra comma at the end. Try the update.
KennyTM
Thanks, but removing last comma is not effective. Same errors.
Eonil
@Eonil: Oops. You need **two** braces as well. See update.
KennyTM
Wow! Cool! It works! And clear explanation! Thanks!
Eonil