mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 13:58:47 +00:00
ToArray method added.
This commit is contained in:
parent
957a21a299
commit
ee87b63da0
1 changed files with 16 additions and 12 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue