我可以这样初始化float32x4_t:
const float32x4x4_t zero = { 0.0f, 0.0f, 0.0f, 0.0f };
但是,此代码在初始化程序中使错误不兼容类型:
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是4x4矩阵,构建为:
typedef struct float32x4x4_t
{
float32x4_t val[4];
}
float32x4x4_t;
如何初始化此const结构?
最佳答案
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}
}};
括号的第一级用于该结构。
第二层是
float32x4_t
数组。第三层是
float32x4_t
本身。关于c - 如何初始化const float32x4x4_t(ARM NEON内在函数,GCC)?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2749848/