/// <summary> /// Copies the memory array to the target memory array passed as argument. /// </summary> /// <param name="target">The target memory array that this memory array should be copied to.</param> public void CopyTo(ref MemoryArray <T> target) { Assert.IsTrue(target.Length == length); UnsafeUtility.MemCpy( target.ptr, ptr, Length * UnsafeUtility.SizeOf <T>()); }
public MemoryArray(MemoryArray <T> array, int startIndex = 0, int subLength = -1) { System.Int64 address = (System.Int64)array.ptr; address += UnsafeUtility.SizeOf <T>() * startIndex; ptr = (void *)address; length = subLength >= 0 ? subLength : array.Length; }
internal int GetFragmentIndex(MemoryArray <Interval> intervals, IntervalIndex index) { int fragmentIndex = 0; int numIntervals = intervals.Length; for (int i = 0; i < numIntervals; ++i) { var intervalIndex = this.intervals[i]; if (intervalIndex == index) { return(fragmentIndex); } fragmentIndex += intervals[intervalIndex].numFrames; } return(-1); }