如何初始化 const float32x4x4_t(ARM NEON 内在函数,GCC)?

发布于 2024-08-30 23:38:49 字数 489 浏览 3 评论 0原文

我可以像这样初始化 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 结构?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

韵柒 2024-09-06 23:38:49
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 本身。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文