mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
ToArray method added.
This commit is contained in:
parent
957a21a299
commit
ee87b63da0
1 changed files with 16 additions and 12 deletions
|
|
@ -111,18 +111,6 @@ namespace Cosmos.Core
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
public void Copy(int[] aData)
|
||||||
{
|
{
|
||||||
Copy(0, aData, 0, aData.Length);
|
Copy(0, aData, 0, aData.Length);
|
||||||
|
|
@ -227,6 +215,22 @@ namespace Cosmos.Core
|
||||||
}
|
}
|
||||||
#endregion ReadWrite
|
#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
|
public class MemoryBlock08
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue