ToArray method added.

This commit is contained in:
valentinbreiz 2018-09-23 14:24:26 +02:00 committed by GitHub
parent 957a21a299
commit ee87b63da0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,18 +110,6 @@ namespace Cosmos.Core
MemoryOperations.Copy(xDest, aDataPtr + aIndex, aCount);
}
}
public unsafe int[] Copy(int aStart, int aIndex, int aCount)
{
// TODO thow exception if aStart and aCount are not in bound. I've tried to do this but Bochs dies :-(
int* xDest = (int*)(Base + aStart);
int[] array = new int[aCount];
fixed (int* aArrayPtr = array)
{
MemoryOperations.Copy(aArrayPtr + aIndex, xDest, aCount);
}
return array;
}
public void Copy(int[] aData)
{
@ -227,6 +215,22 @@ namespace Cosmos.Core
}
#endregion ReadWrite
public unsafe uint[] ToArray(int aStart, int aIndex, int aCount)
{
uint* xDest = (uint*)(Base + aStart);
uint[] array = new uint[aCount];
fixed (uint* aArrayPtr = array)
{
MemoryOperations.Copy(aArrayPtr + aIndex, xDest, aCount);
}
return array;
}
public uint[] ToArray()
{
return ToArray(0, 0, (int)Size);
}
}
public class MemoryBlock08