1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-20 08:58:00 +02:00

Proper MemMove

This commit is contained in:
Brian Fiete 2021-09-20 06:38:08 -07:00
parent 0dc45cb712
commit ce21b8d542
2 changed files with 7 additions and 6 deletions

View file

@ -535,7 +535,7 @@ namespace System.Collections
if (mSize == AllocSize) EnsureCapacity(mSize + 1, true);
if (index < mSize)
{
Internal.MemCpy(mItems + index + 1, mItems + index, (mSize - index) * strideof(T), alignof(T));
Internal.MemMove(mItems + index + 1, mItems + index, (mSize - index) * strideof(T), alignof(T));
}
mItems[index] = item;
mSize++;
@ -554,7 +554,7 @@ namespace System.Collections
if (mSize + addCount > AllocSize) EnsureCapacity(mSize + addCount, true);
if (index < mSize)
{
Internal.MemCpy(mItems + index + addCount, mItems + index, (mSize - index) * strideof(T), alignof(T));
Internal.MemMove(mItems + index + addCount, mItems + index, (mSize - index) * strideof(T), alignof(T));
}
Internal.MemCpy(mItems + index, items.Ptr, addCount * strideof(T));
mSize += (int_cosize)addCount;
@ -568,7 +568,7 @@ namespace System.Collections
Debug.Assert((uint)index < (uint)mSize);
if (index < mSize - 1)
{
Internal.MemCpy(mItems + index, mItems + index + 1, (mSize - index - 1) * strideof(T), alignof(T));
Internal.MemMove(mItems + index, mItems + index + 1, (mSize - index - 1) * strideof(T), alignof(T));
}
mSize--;
#if VERSION_LIST