Skip to main content
 首页 » 编程设计

c#之Mono.Simd Vector3( float )丢失了吗

2024年02月24日18shihaiming

嘿,我正在尝试使用 Mono 的 SIMD 来处理我项目中的坐标 (X,Y,Z), 但我只看到对 Vector2 和 Vector4 类型的支持。以前有没有人遇到过这个问题,是否有任何解决方法?

提前致谢。

请您参考如下方法:

这与寄存器的工作方式有关。您可以只使用 Vector4f 并将 W 部分设置为 0 或 1(取决于您要对向量执行的操作),一切都会好起来的。

http://tirania.org/blog/archive/2008/Nov-03.html解释:

On x86 processors these instructions use a new register bank (the XMM registers) and can be configured to work on 16 bytes at a time using a number of possible combinations:

* byte-level operations on 16 elements. 
* short-level operations on 8 elements. 
* single precision or integer-level operations on 4 elements. 
* double precision or long-integer operations on 2 elements.