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