using System; using System.Diagnostics.Contracts; using System.Numerics; using System.Runtime.InteropServices; namespace ComputeSharp { /// /// A that contains extension methods for the , and types /// public static class VectorExtensions { /// /// Converts a array into a with items of type /// /// The input array /// A with items of type , mapping the original array [Pure] public static Span AsFloat2Span(this Vector2[] array) => MemoryMarshal.Cast(array); /// /// Converts a into a with items of type /// /// The input /// A with items of type , mapping the original [Pure] public static Span AsFloat2Span(this Span span) => MemoryMarshal.Cast(span); /// /// Converts a array into a with items of type /// /// The input array /// A with items of type , mapping the original array [Pure] public static Span AsFloat3Span(this Vector3[] array) => MemoryMarshal.Cast(array); /// /// Converts a into a with items of type /// /// The input /// A with items of type , mapping the original [Pure] public static Span AsFloat3Span(this Span span) => MemoryMarshal.Cast(span); /// /// Converts a array into a with items of type /// /// The input array /// A with items of type , mapping the original array [Pure] public static Span AsFloat4Span(this Vector4[] array) => MemoryMarshal.Cast(array); /// /// Converts a into a with items of type /// /// The input /// A with items of type , mapping the original [Pure] public static Span AsFloat4Span(this Span span) => MemoryMarshal.Cast(span); } }