SIMD16

struct SIMD16

A vector of 16 scalar values.

Inheritance SIMD, CustomDebugStringConvertible
Associated Types
public typealias MaskStorage = SIMD16<Scalar.SIMDMaskScalar>

Initializers

init init() Required

Creates a vector with zero in all lanes.

Declaration

public init()
init init(_:) Required

Creates a vector from the given sequence.

Precondition: scalars must have the same number of elements as the vector type.

  • Parameter scalars: The elements to use in the vector.

Declaration

@inlinable public init<S>(_ scalars: S) where S: Sequence, Self.Scalar == S.Element
init init(_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:_:) Required

Creates a new vector from the given elements.

Declaration

public init(_ v0: Scalar, _ v1: Scalar, _ v2: Scalar, _ v3: Scalar, _ v4: Scalar, _ v5: Scalar, _ v6: Scalar, _ v7: Scalar, _ v8: Scalar, _ v9: Scalar, _ v10: Scalar, _ v11: Scalar, _ v12: Scalar, _ v13: Scalar, _ v14: Scalar, _ v15: Scalar)
init init(arrayLiteral:) Required

Creates a vector from the specified elements.

  • Parameter scalars: The elements to use in the vector. scalars must have the same number of elements as the vector type.

Declaration

@inlinable public init(arrayLiteral scalars: Self.Scalar)
init init(from:) Required

Creates a new vector by decoding scalars from the given decoder.

This initializer throws an error if reading from the decoder fails, or if the data read is corrupted or otherwise invalid.

  • Parameter decoder: The decoder to read data from.

Declaration

public init(from decoder: Decoder) throws
init init(lowHalf:highHalf:) Required

Creates a new vector from two half-length vectors.

Declaration

public init(lowHalf: SIMD8<Scalar>, highHalf: SIMD8<Scalar>)
init init(repeating:) Required

A vector with the specified value in all lanes.

Declaration

public init(repeating value: Self.Scalar)

Instance Variables

var debugDescription Required

A textual representation of this instance, suitable for debugging.

Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(reflecting:) initializer. This initializer works with any type, and uses the custom debugDescription property for types that conform to CustomDebugStringConvertible:

struct Point: CustomDebugStringConvertible {
    let x: Int, y: Int

    var debugDescription: String {
        return "(\(x), \(y))"
    }
}

let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"

The conversion of p to a string in the assignment to s uses the Point type's debugDescription property.

Declaration

var debugDescription: String
var description Required

A textual description of the vector.

Declaration

var description: String
var evenHalf Required

A half-length vector made up of the even elements of the vector.

Declaration

var evenHalf: SIMD8<Scalar>
var highHalf Required

A half-length vector made up of the high elements of the vector.

Declaration

var highHalf: SIMD8<Scalar>
var indices Required

The valid indices for subscripting the vector.

Declaration

var indices: Range<Int>
var lowHalf Required

A half-length vector made up of the low elements of the vector.

Declaration

var lowHalf: SIMD8<Scalar>
var oddHalf Required

A half-length vector made up of the odd elements of the vector.

Declaration

var oddHalf: SIMD8<Scalar>
var scalarCount Required

The number of scalars in the vector.

Declaration

var scalarCount: Int

Subscripts

subscript subscript(index:) Required

Accesses the scalar at the specified position.

Declaration

public subscript(index: Int) -> Scalar
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD2.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD2<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD2<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD3.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD3<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD3<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD4.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD4<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD4<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD8.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD8<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD8<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD16.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD16<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD16<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD32.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD32<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD32<Self.Scalar>
subscript subscript(index:) Required

Extracts the scalars at specified indices to form a SIMD64.

The elements of the index vector are wrapped modulo the count of elements in this vector. Because of this, the index is always in-range and no trap can occur.

Declaration

public subscript<Index>(index: SIMD64<Index>) where Index: FixedWidthInteger, Index: SIMDScalar, Self.Scalar: SIMDScalar -> SIMD64<Self.Scalar>

Instance Methods

func encode(to encoder: Encoder) throws Required

Encodes the scalars of this vector into the given encoder in an unkeyed container.

This function throws an error if any values are invalid for the given encoder's format.

  • Parameter encoder: The encoder to write data to.

Declaration

public func encode(to encoder: Encoder) throws
func hash(into hasher: inout Hasher) Required

Hashes the elements of the vector using the given hasher.

Declaration

@inlinable public func hash(into hasher: inout Hasher)
func replace(with other: Self, where mask: SIMDMask<Self.MaskStorage>) Required

Replaces elements of this vector with elements of other in the lanes where mask is true.

Declaration

public mutating func replace(with other: Self, where mask: SIMDMask<Self.MaskStorage>)
func replace(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>) Required

Replaces elements of this vector with other in the lanes where mask is true.

Declaration

public mutating func replace(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>)
func replacing(with other: Self, where mask: SIMDMask<Self.MaskStorage>) -> Self Required

Returns a copy of this vector, with elements replaced by elements of other in the lanes where mask is true.

Declaration

public func replacing(with other: Self, where mask: SIMDMask<Self.MaskStorage>) -> Self
func replacing(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>) -> Self Required

Returns a copy of this vector, with elements other in the lanes where mask is true.

Declaration

public func replacing(with other: Self.Scalar, where mask: SIMDMask<Self.MaskStorage>) -> Self

Type Methods

func .!=(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise inequality comparison.

Declaration

public static func .!=(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .!=(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise inequality comparison.

Declaration

public static func .!=(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .!=(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise inequality comparison.

Declaration

public static func .!=(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise equality comparison.

Declaration

public static func .==(lhs: Self, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise equality comparison.

Declaration

public static func .==(lhs: Self.Scalar, rhs: Self) -> SIMDMask<Self.MaskStorage>
func .==(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage> Required

Returns a vector mask with the result of a pointwise equality comparison.

Declaration

public static func .==(lhs: Self, rhs: Self.Scalar) -> SIMDMask<Self.MaskStorage>
func ==(lhs: Self, rhs: Self) -> Bool Required

Returns a Boolean value indicating whether two vectors are equal.

Declaration

public static func ==(lhs: Self, rhs: Self) -> Bool