Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector SIMD types in Swift

I was wondering if it's possible to use the SIMD types defined in <simd/simd.h> (such as vector_float3) in Swift. I can't seem to figure out a way to do it.

Thanks!

like image 421
Litherum Avatar asked Sep 07 '14 16:09

Litherum


People also ask

What are SIMD vectorized instructions?

A vector is an instruction operand containing a set of data elements packed into a one-dimensional array. The elements can be integer or floating-point values. Most Vector/SIMD Multimedia Extension and SPU instructions operate on vector operands.

What is vector in Swift?

Overview. A vector is comparable to a fixed-length array containing integer or floating-point values. The simd framework provides support for small vectors, that is, vectors that contain up to eight double-precision or sixteen single-precision values.


1 Answers

Just a heads up for this question for it to be up to date - SIMD Vectors have been announced at WWDC '15 for Swift 2.0:

SIMD Support:Clang extended vectors are imported and usable in Swift, enabling many graphics and other low-level numeric APIs (e.g. simd.h) to be usable in Swift.

So the answer from now on - yes, it's possible.

like image 193
Michal Avatar answered Oct 09 '22 16:10

Michal