Cosmos/source/Cosmos.Core.Plugs/System/ObjectImpl.cs
2016-06-14 13:51:16 -04:00

30 lines
No EOL
804 B
C#

using Cosmos.IL2CPU.Plugs;
namespace Cosmos.Core.Plugs.System
{
[Plug(Target = typeof(object))]
public class ObjectImpl
{
public static unsafe uint MemberwiseClone(uint aThis)
{
// pointers are handles!
var xThisPointer = (uint*)aThis;
var xSize = xThisPointer[1];
var xResult = GCImplementionImpl.AllocNewObject(xSize);
var xThatPointer = (uint*)xResult;
var xThatPointerByte = (byte*)xThatPointer[0];
var xThisSimplePointer = (uint*)aThis;
var xThisPointerByte = (byte*)xThisSimplePointer[0];
for (int i = 0; i < xSize; i++)
{
xThatPointerByte[i] = xThisPointerByte[i];
}
return xResult;
}
}
}