Search code examples
swiftxcodesimdxcode9-beta

Xcode 9: can't convert float3 to int3


While trying to compile my project in Xcode 9, I get errors for conversions from float3 to int3. The following line now fails to compile:

var max : int3 = vector_int(bounds.maxBounds * float3(1.0/8.0) + float3(1.0))

With the error:

Use of unresolved identifier 'vector_int'

So the old conversion function vector_int has gone away. The "fix it" suggestion doesn't work either.

var max : int3 = vector_int3(bounds.maxBounds * float3(1.0/8.0) + float3(1.0))

yields:

Cannot invoke initializer for type 'vector_int3' with an argument list of type '(float3)'

I can write my own little conversion functions, but surely there's a built-in way to do this, no?


Solution

  • vector_int has been replaced by simd_int:

    var max : int3 = simd_int(bounds.maxBounds * float3(1.0/8.0) + float3(1.0))