public NativeSliceDebugView(NativeSlice <T> array) { m_Array = array; }
public NativeSlice(NativeSlice <T> slice, int start) : this(slice, start, slice.Length - start) { }
public bool Equals(NativeSlice <T> other) { return(m_Buffer == other.m_Buffer && m_Stride == other.m_Stride && m_Length == other.m_Length); }
public static NativeSlice <T> Slice <T>(this NativeSlice <T> thisSlice, int start, int length) where T : struct { return(new NativeSlice <T>(thisSlice, start, length)); }
internal ElementEnumerator(ref NativeSlice <T> slice) { Slice = slice; IndexEnumerator = new IndexEnumerator(ref slice); }
public static NativeSlice <T> Slice <T>(this NativeSlice <T> thisSlice) where T : struct { return(thisSlice); }
/// <summary> /// Binary search for the value in the sorted container. /// </summary> /// <typeparam name="T">Source type of elements</typeparam> /// <param name="container">The container to perform search.</param> /// <param name="value">The value to search for.</param> /// <returns>Positive index of the specified value if value is found. Otherwise bitwise complement of index of first greater value.</returns> /// <remarks>Array must be sorted, otherwise value searched might not be found even when it is in array. IComparer corresponds to IComparer used by sort.</remarks> public static int BinarySearch <T>(this NativeSlice <T> container, T value) where T : unmanaged, IComparable <T> { return(container.BinarySearch(value, new DefaultComparer <T>())); }
public Enumerator(ref NativeSlice <T> array) { this.m_Array = array; this.m_Index = -1; }
/// <summary> /// Sorts the container in ascending order. /// </summary> /// <typeparam name="T">Source type of elements</typeparam> /// <param name="container">The container to perform sort.</param> /// <param name="inputDeps">The job handle or handles for any scheduled jobs that use this container.</param> /// <returns>A new job handle containing the prior handles as well as the handle for the job that sorts /// the container.</returns> public unsafe static JobHandle Sort <T>(this NativeSlice <T> container, JobHandle inputDeps) where T : unmanaged, IComparable <T> { return(container.Sort(new DefaultComparer <T>(), inputDeps)); }
/// <summary> /// Sorts the container using a custom comparison function. /// </summary> /// <typeparam name="T">Source type of elements</typeparam> /// <typeparam name="U">The comparer type.</typeparam> /// <param name="container">The container to perform sort.</param> /// <param name="comp">A comparison function that indicates whether one element in the array is less than, equal to, or greater than another element.</param> /// <param name="inputDeps">The job handle or handles for any scheduled jobs that use this container.</param> /// <returns>A new job handle containing the prior handles as well as the handle for the job that sorts /// the container.</returns> public unsafe static JobHandle Sort <T, U>(this NativeSlice <T> container, U comp, JobHandle inputDeps) where T : unmanaged where U : IComparer <T> { return(Sort((T *)container.GetUnsafePtr(), container.Length, comp, inputDeps)); }
public unsafe NativeSlice(NativeSlice <T> slice, int start, int length) { m_Stride = slice.m_Stride; m_Buffer = slice.m_Buffer + m_Stride * start; m_Length = length; }
public void CopyFrom(NativeSlice <T> slice) { UnsafeUtility.MemCpyStride(this.GetUnsafePtr(), Stride, slice.GetUnsafeReadOnlyPtr(), slice.Stride, UnsafeUtility.SizeOf <T>(), m_Length); }
public NativeSlice(NativeSlice <T> slice, int start) { this = new NativeSlice <T>(slice, start, slice.Length - start); }
public NativeSlice(NativeArray <T> array) { this = new NativeSlice <T>(array, 0, array.Length); }
/// <summary> /// Binary search for the value in the sorted container. /// </summary> /// <typeparam name="T">Source type of elements</typeparam> /// <typeparam name="U">The comparer type.</typeparam> /// <param name="container">The container to perform search.</param> /// <param name="value">The value to search for.</param> /// <returns>Positive index of the specified value if value is found. Otherwise bitwise complement of index of first greater value.</returns> /// <remarks>Array must be sorted, otherwise value searched might not be found even when it is in array. IComparer corresponds to IComparer used by sort.</remarks> public unsafe static int BinarySearch <T, U>(this NativeSlice <T> container, T value, U comp) where T : unmanaged where U : IComparer <T> { return(BinarySearch((T *)container.GetUnsafePtr(), container.Length, value, comp)); }
public NativeSlice(NativeArray <T> array, int start) { this = new NativeSlice <T>(array, start, array.Length - start); }
/// <summary> /// Sorts a slice using a custom comparison function. /// </summary> /// <typeparam name="T">Source type of elements</typeparam> /// <typeparam name="U">The comparer type.</typeparam> /// <param name="slice">List to perform sort.</param> /// <param name="comp">A comparison function that indicates whether one element in the array is less than, equal to, or greater than another element.</param> public unsafe static void Sort <T, U>(this NativeSlice <T> slice, U comp) where T : struct where U : IComparer <T> { CheckStrideMatchesSize <T>(slice.Stride); IntroSort <T, U>(slice.GetUnsafePtr(), slice.Length, comp); }
// Native slice public unsafe static void Sort <T>(this NativeSlice <T> slice) where T : struct, IComparable <T> { slice.Sort(new DefaultComparer <T>()); }
internal IndexEnumerator(ref NativeSlice <T> slice) { Slice = slice; Index = -1; }