mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-23 18:18:00 +02:00
CopyTo's
This commit is contained in:
parent
9ca36030cd
commit
e8ea4e3b2d
2 changed files with 24 additions and 0 deletions
|
@ -530,6 +530,22 @@ namespace System.Collections
|
|||
span[i] = mItems[i];
|
||||
}
|
||||
|
||||
public void CopyTo(Span<T> array, int arrayIndex)
|
||||
{
|
||||
// Delegate rest of error checking to Array.Copy.
|
||||
for (int i = 0; i < mSize; i++)
|
||||
array[i + arrayIndex] = mItems[i];
|
||||
}
|
||||
|
||||
public void CopyTo(int index, Span<T> array, int arrayIndex, int count)
|
||||
{
|
||||
Debug.Assert((uint)index < (uint)mSize);
|
||||
Debug.Assert((uint)index + (uint)count <= (uint)mSize);
|
||||
// Delegate rest of error checking to Array.Copy.
|
||||
for (int i = 0; i < count; i++)
|
||||
array[i + arrayIndex] = mItems[i + index];
|
||||
}
|
||||
|
||||
public void CopyTo(T[] array, int arrayIndex)
|
||||
{
|
||||
// Delegate rest of error checking to Array.Copy.
|
||||
|
|
|
@ -294,6 +294,14 @@ namespace System
|
|||
Internal.MemMove(destination.mPtr, mPtr, Internal.GetArraySize<T>(mLength), (int32)alignof(T));
|
||||
}
|
||||
|
||||
public void CopyTo(int index, Span<T> array, int arrayIndex, int count)
|
||||
{
|
||||
Debug.Assert((uint)index < (uint)Length);
|
||||
Debug.Assert((uint)index + (uint)count <= (uint)Length);
|
||||
for (int i = 0; i < count; i++)
|
||||
array[i + arrayIndex] = Ptr[i + index];
|
||||
}
|
||||
|
||||
public Span<uint8> ToRawData()
|
||||
{
|
||||
return Span<uint8>((uint8*)mPtr, mLength * sizeof(T));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue