Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using IL2CPU.API.Attribs;
using Cosmos.Core.Memory;
using Cosmos.Core;

namespace System.Runtime.InteropServices
{
[Plug("System.Runtime.InteropServices.NativeMemory, System.Private.CoreLib")]
public static unsafe class NativeMemory
{
public static void* Realloc(void* ptr, nuint byteCount)
{
return Heap.Realloc((byte*)ptr, (uint)byteCount);
}

public static void* Alloc(nuint elementCount, nuint elementSize)
{
return Heap.Alloc((uint)(elementCount * elementSize));
}
public static void* Alloc(nuint byteCount)
{
return Heap.Alloc((uint)byteCount);
}

public static void Free(void* ptr)
{
Heap.Free(ptr);
}
}
}