Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ AlignedAlloc()

static unsafe void * System.Runtime.InteropServices.NativeMemory.AlignedAlloc ( nuint byteCount,
nuint alignment )
inlinestatic

Definition at line 33 of file NativeMemory.cs.

34 {
35 if (!BitOperations.IsPow2(alignment))
36 {
37 ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_AlignmentMustBePow2);
38 }
39 void* ptr = Interop.Ucrtbase._aligned_malloc((byteCount != 0) ? byteCount : 1, alignment);
40 if (ptr == null)
41 {
42 ThrowHelper.ThrowOutOfMemoryException();
43 }
44 return ptr;
45 }
static unsafe void * _aligned_malloc(nuint size, nuint alignment)
static bool IsPow2(int value)

References Interop.Ucrtbase._aligned_malloc(), System.byteCount, System.Numerics.BitOperations.IsPow2(), System.ThrowHelper.ThrowArgumentException(), and System.ThrowHelper.ThrowOutOfMemoryException().