Esempio n. 1
0
 public NativeSliceDebugView(NativeSlice <T> array)
 {
     m_Array = array;
 }
Esempio n. 2
0
 public NativeSlice(NativeSlice <T> slice, int start) : this(slice, start, slice.Length - start)
 {
 }
Esempio n. 3
0
 public bool Equals(NativeSlice <T> other)
 {
     return(m_Buffer == other.m_Buffer && m_Stride == other.m_Stride && m_Length == other.m_Length);
 }
Esempio n. 4
0
 public static NativeSlice <T> Slice <T>(this NativeSlice <T> thisSlice, int start, int length) where T : struct
 {
     return(new NativeSlice <T>(thisSlice, start, length));
 }
Esempio n. 5
0
 internal ElementEnumerator(ref NativeSlice <T> slice)
 {
     Slice           = slice;
     IndexEnumerator = new IndexEnumerator(ref slice);
 }
Esempio n. 6
0
 public static NativeSlice <T> Slice <T>(this NativeSlice <T> thisSlice) where T : struct
 {
     return(thisSlice);
 }
Esempio n. 7
0
 /// <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>()));
 }
Esempio n. 8
0
 public Enumerator(ref NativeSlice <T> array)
 {
     this.m_Array = array;
     this.m_Index = -1;
 }
Esempio n. 9
0
 /// <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));
 }
Esempio n. 10
0
 /// <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));
 }
Esempio n. 11
0
 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;
 }
Esempio n. 12
0
 public void CopyFrom(NativeSlice <T> slice)
 {
     UnsafeUtility.MemCpyStride(this.GetUnsafePtr(), Stride, slice.GetUnsafeReadOnlyPtr(), slice.Stride, UnsafeUtility.SizeOf <T>(), m_Length);
 }
Esempio n. 13
0
 public NativeSlice(NativeSlice <T> slice, int start)
 {
     this = new NativeSlice <T>(slice, start, slice.Length - start);
 }
Esempio n. 14
0
 public NativeSlice(NativeArray <T> array)
 {
     this = new NativeSlice <T>(array, 0, array.Length);
 }
Esempio n. 15
0
 /// <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));
 }
Esempio n. 16
0
 public NativeSlice(NativeArray <T> array, int start)
 {
     this = new NativeSlice <T>(array, start, array.Length - start);
 }
Esempio n. 17
0
 /// <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);
 }
Esempio n. 18
0
 // Native slice
 public unsafe static void Sort <T>(this NativeSlice <T> slice) where T : struct, IComparable <T>
 {
     slice.Sort(new DefaultComparer <T>());
 }
Esempio n. 19
0
 internal IndexEnumerator(ref NativeSlice <T> slice)
 {
     Slice = slice;
     Index = -1;
 }