mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-30 17:49:57 -06:00
Move solution and projects to src
This commit is contained in:
27
src/ARMeilleure/Common/NativeAllocator.cs
Normal file
27
src/ARMeilleure/Common/NativeAllocator.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ARMeilleure.Common
|
||||
{
|
||||
unsafe sealed class NativeAllocator : Allocator
|
||||
{
|
||||
public static NativeAllocator Instance { get; } = new();
|
||||
|
||||
public override void* Allocate(ulong size)
|
||||
{
|
||||
void* result = (void*)Marshal.AllocHGlobal((IntPtr)size);
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
throw new OutOfMemoryException();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void Free(void* block)
|
||||
{
|
||||
Marshal.FreeHGlobal((IntPtr)block);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user