File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
source/Cosmos.Core_Plugs/System/Runtime/InteropServices Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ using IL2CPU . API . Attribs ;
2+ using Cosmos . Core . Memory ;
3+ using Cosmos . Core ;
4+
5+ namespace System . Runtime . InteropServices
6+ {
7+ [ Plug ( "System.Runtime.InteropServices.NativeMemory, System.Private.CoreLib" ) ]
8+ public static unsafe class NativeMemory
9+ {
10+ public static void * Realloc ( void * ptr , nuint byteCount )
11+ {
12+ return Heap . Realloc ( ( byte * ) ptr , ( uint ) byteCount ) ;
13+ }
14+
15+ public static void * Alloc ( nuint elementCount , nuint elementSize )
16+ {
17+ return Heap . Alloc ( ( uint ) ( elementCount * elementSize ) ) ;
18+ }
19+ public static void * Alloc ( nuint byteCount )
20+ {
21+ return Heap . Alloc ( ( uint ) byteCount ) ;
22+ }
23+
24+ public static void Free ( void * ptr )
25+ {
26+ Heap . Free ( ptr ) ;
27+ }
28+ }
29+ }
You can’t perform that action at this time.
0 commit comments