diff --git a/source/Cosmos.Core/MemoryBlock.cs b/source/Cosmos.Core/MemoryBlock.cs index 4267390da..e119a2d0a 100644 --- a/source/Cosmos.Core/MemoryBlock.cs +++ b/source/Cosmos.Core/MemoryBlock.cs @@ -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