1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-23 18:18:00 +02:00
This commit is contained in:
Brian Fiete 2024-02-22 06:51:51 -05:00
parent 9ca36030cd
commit e8ea4e3b2d
2 changed files with 24 additions and 0 deletions

View file

@ -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.

View file

@ -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));