我找不到铁锈-SIMD的例子。我能找到的最接近的是这一个。经调整后,它变成:
#![feature(core)]
#![feature(portable_simd)]
use std::simd::f32x4;
fn main() {
let x = f32x4(1.0, 1.0, 1.0, 1.0);
}但货物仍在抱怨
error[E0423]: expected function, found type alias `f32x4`
--> src/main.rs:7:13
|
7 | let x = f32x4(1.0, 1.0, 1.0, 1.0);
| ^^^^^
|
= note: can't use a type alias as a constructor在建筑过程中。
我如何让这个简单的例子起作用?
Cargo.toml
[package]
name = "rust-simd"
version = "0.1.0"
edition = "2021"
[dependencies]我已经打开了nightly:rustup default nightly。
发布于 2022-05-26 00:06:35
用std::simd构造SIMD向量的方法是type::from(array),例如f32x4::from([1.0, 1.0, 1.0, 1.0])。这里提到的是在文件中。
https://stackoverflow.com/questions/72385320
复制相似问题