Photon Fusion
2.0.8
Native Memory Allocator More...
Static Public Member Functions | |
| static void * | AlignPointer (void *pointer, int alignment) |
| Aligns a pointer to a specified alignment. More... | |
| static void | ArrayClear< T > (T *ptr, int size) |
| Clears a range of elements in an array by setting them to zero. More... | |
| static int | ArrayCompare< T > (T *ptr1, T *ptr2, int size) |
| Compares two arrays for equality. More... | |
| static void | ArrayCopy (void *source, int sourceIndex, void *destination, int destinationIndex, int count, int elementStride) |
| Copies a range of elements from one array to another. More... | |
| static int | CopyFromArray< T > (void *destination, T[] source) |
| Copies elements from a managed array to an unmanaged memory location. More... | |
| static int | CopyToArray< T > (T[] destination, void *source) |
| Copies elements from an unmanaged memory location to a managed array. More... | |
| static T * | DoubleArray< T > (T *array, int currentLength) |
| Doubles the size of an array by expanding it to twice its current length. More... | |
| static T ** | DoublePtrArray< T > (T **array, int currentLength) |
| Doubles the size of an array of pointers by expanding it to twice its current length. More... | |
| static T | Empty< T > () |
| Returns an empty instance of the specified unmanaged type. More... | |
| static void * | Expand (void *buffer, int currentSize, int newSize) |
| Expands a buffer to a new specified size. More... | |
| static T * | ExpandArray< T > (T *array, int currentLength, int newLength) |
| Expands an array to a new specified length. More... | |
| static T ** | ExpandPtrArray< T > (T **array, int currentLength, int newLength) |
| Expands an array of pointers to a new specified length. More... | |
| static void | Free (ref void *memory) |
| Frees a block of memory. More... | |
| static void | Free< T > (ref T **memory) |
| Frees a block of memory. More... | |
| static void | Free< T > (ref T *memory) |
| Frees a block of memory. More... | |
| static int | GetAlignment (int stride) |
| Gets the alignment of the specified stride. More... | |
| static int | GetAlignment< T > () |
| Gets the alignment of the specified unmanaged type. More... | |
| static int | GetFieldOffset (System.Reflection.FieldInfo fi) |
| Gets the offset of the specified field. More... | |
| static int | GetLengthPrefixedUTF8ByteCount (string str) |
| Gets the byte count of a UTF-8 encoded string with a length prefix. More... | |
| static int | GetMaxAlignment (int a, int b) |
| Gets the maximum alignment of two given strides. More... | |
| static int | GetMaxAlignment (int a, int b, int c) |
| Gets the maximum alignment of three given strides. More... | |
| static int | GetMaxAlignment (int a, int b, int c, int d) |
| Gets the maximum alignment of four given strides. More... | |
| static int | GetMaxAlignment (int a, int b, int c, int d, int e) |
| Gets the maximum alignment of five given strides. More... | |
| static bool | IsAligned (int stride, int alignment) |
| Checks if a stride is aligned to a specified alignment. More... | |
| static bool | IsPointerAligned (void *pointer, int alignment) |
| Checks if a pointer is aligned to a specified alignment. More... | |
| static void * | Malloc (int size) |
| Allocates a block of memory. More... | |
| static T * | Malloc< T > () |
| Allocates a block of memory for a specified type. More... | |
| static void * | MallocAndClear (int size) |
| Allocates and clears a block of memory. More... | |
| static T * | MallocAndClear< T > () |
| Allocates and clears a block of memory for a specified type. More... | |
| static void * | MallocAndClearArray (int stride, int length) |
| Allocates and clears an array of memory blocks. More... | |
| static T * | MallocAndClearArray< T > (int length) |
| Allocates and clears an array of memory blocks for a specified type. More... | |
| static T * | MallocAndClearArrayMin1< T > (int length) |
| Allocates and clears an array of memory blocks for a specified type, ensuring a minimum length of 1. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, int size7, int size8, int size9, int size10, int size11, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, out void *ptr7, out void *ptr8, out void *ptr9, out void *ptr10, out void *ptr11, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, int size7, int size8, int size9, int size10, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, out void *ptr7, out void *ptr8, out void *ptr9, out void *ptr10, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, int size7, int size8, int size9, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, out void *ptr7, out void *ptr8, out void *ptr9, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, int size7, int size8, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, out void *ptr7, out void *ptr8, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, int size7, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, out void *ptr7, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, int size6, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, out void *ptr6, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, int size5, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, out void *ptr5, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, int size4, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, out void *ptr4, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, int size3, out void *ptr0, out void *ptr1, out void *ptr2, out void *ptr3, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, int size2, out void *ptr0, out void *ptr1, out void *ptr2, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static int | MallocAndClearBlock (int size0, int size1, out void *ptr0, out void *ptr1, int alignment=ALIGNMENT) |
| Allocates a block of memory and clears it. More... | |
| static T ** | MallocAndClearPtrArray< T > (int length) |
| Allocates and clears an array of pointers for a specified type. More... | |
| static T ** | MallocAndClearPtrArrayMin1< T > (int length) |
| Allocates and clears an array of pointers for a specified type, ensuring a minimum length of 1. More... | |
| static void | MemClear (Span< int > ptr) |
| Clears a block of memory by setting it to zero. More... | |
| static void | MemClear (void *ptr, int size) |
| Clears a block of memory by setting it to zero. More... | |
| static int | MemCmp (void *ptr1, void *ptr2, int size) |
| Compares two blocks of memory. More... | |
| static void | MemCpy (void *destination, void *source, int size) |
| Copies a block of memory from the source to the destination. More... | |
| static void | MemCpyFast (void *d, void *s, int size) |
| Copies memory quickly for specific sizes. More... | |
| static void | MemMove (void *destination, void *source, int size) |
| Moves a block of memory from the source to the destination. More... | |
| static int | ReadLengthPrefixedUTF8 (void *source, out string result) |
| Reads a length-prefixed UTF-8 encoded string from a memory location. More... | |
| static unsafe byte * | ReferenceToPointer< T > (ref T obj) |
| Converts a reference to an unmanaged type to a pointer. More... | |
| static int | RoundBitsUpTo32 (int bits) |
| Rounds the given number of bits up to the nearest multiple of 32. More... | |
| static int | RoundBitsUpTo64 (int bits) |
| Rounds the given number of bits up to the nearest multiple of 64. More... | |
| static int | RoundToAlignment (int stride, int alignment) |
| Rounds a stride to a specified alignment. More... | |
| static long | RoundToAlignment (long stride, int alignment) |
| Rounds a stride to a specified alignment. More... | |
| static int | RoundToMaxAlignment (int stride) |
| Rounds a stride to the maximum alignment. More... | |
| static int | SizeOf (Type t) |
| Gets the size of the specified type. More... | |
| static void | ValidateBlockSentinels (IntPtr memory, int size) |
| Validates the block sentinels to ensure memory integrity. More... | |
| static int | WordCount (int stride, int wordSize) |
| Calculates the word count for a given stride and word size. More... | |
| static int | WriteLengthPrefixedUTF8 (void *destination, string str) |
| Writes a length-prefixed UTF-8 encoded string to a memory location. More... | |
Static Public Attributes | |
| const int | ALIGNMENT = 8 |
| The alignment size in bytes. More... | |
| const int | CACHE_LINE_SIZE = 64 |
| The size of the cache line in bytes. More... | |
|
static |
Aligns a pointer to a specified alignment.
| pointer | The pointer to align. |
| alignment | The alignment to apply. |
|
static |
Clears a range of elements in an array by setting them to zero.
| T | The type of the elements in the array. |
| ptr | The pointer to the array. |
| size | The number of elements to clear. |
| T | : | unmanaged |
|
static |
Compares two arrays for equality.
| T | The type of the elements in the arrays. |
| ptr1 | The pointer to the first array. |
| ptr2 | The pointer to the second array. |
| size | The number of elements to compare. |
| T | : | unmanaged |
|
static |
Copies a range of elements from one array to another.
| source | The source array pointer. |
| sourceIndex | The zero-based index in the source array at which copying begins. |
| destination | The destination array pointer. |
| destinationIndex | The zero-based index in the destination array at which storing begins. |
| count | The number of elements to copy. |
| elementStride | The size of each element in bytes. |
|
static |
Copies elements from a managed array to an unmanaged memory location.
| T | The type of the elements in the array. |
| destination | The destination pointer. |
| source | The source array. |
| T | : | unmanaged |
|
static |
Copies elements from an unmanaged memory location to a managed array.
| T | The type of the elements in the array. |
| destination | The destination array. |
| source | The source pointer. |
| T | : | unmanaged |
|
static |
Doubles the size of an array by expanding it to twice its current length.
| T | The type of the elements in the array. |
| array | The pointer to the array to double. |
| currentLength | The current length of the array. |
| T | : | unmanaged |
|
static |
Doubles the size of an array of pointers by expanding it to twice its current length.
| T | The type of the elements in the array. |
| array | The pointer to the array of pointers to double. |
| currentLength | The current length of the array. |
| T | : | unmanaged |
|
static |
Returns an empty instance of the specified unmanaged type.
| T | The type of the instance to return. |
| T | : | unmanaged |
|
static |
Expands a buffer to a new specified size.
| buffer | The pointer to the buffer to expand. |
| currentSize | The current size of the buffer. |
| newSize | The new size of the buffer. |
|
static |
Expands an array to a new specified length.
| T | The type of the elements in the array. |
| array | The pointer to the array to expand. |
| currentLength | The current length of the array. |
| newLength | The new length of the array. |
| T | : | unmanaged |
|
static |
Expands an array of pointers to a new specified length.
| T | The type of the elements in the array. |
| array | The pointer to the array of pointers to expand. |
| currentLength | The current length of the array. |
| newLength | The new length of the array. |
| T | : | unmanaged |
|
static |
Frees a block of memory.
| memory | The pointer to the memory block to free. |
|
static |
Frees a block of memory.
| memory | The pointer to the memory block to free. |
| T | : | unmanaged |
|
static |
Frees a block of memory.
| memory | The pointer to the memory block to free. |
| T | : | unmanaged |
|
static |
Gets the alignment of the specified stride.
| stride | The stride to get the alignment of. |
|
static |
Gets the alignment of the specified unmanaged type.
| T | The type to get the alignment of. |
| T | : | unmanaged |
|
static |
Gets the offset of the specified field.
| fi | The field information. |
|
static |
Gets the byte count of a UTF-8 encoded string with a length prefix.
| str | The string to encode. |
|
static |
Gets the maximum alignment of two given strides.
| a | The first stride. |
| b | The second stride. |
|
static |
Gets the maximum alignment of three given strides.
| a | The first stride. |
| b | The second stride. |
| c | The third stride. |
|
static |
Gets the maximum alignment of four given strides.
| a | The first stride. |
| b | The second stride. |
| c | The third stride. |
| d | The fourth stride. |
|
static |
Gets the maximum alignment of five given strides.
| a | The first stride. |
| b | The second stride. |
| c | The third stride. |
| d | The fourth stride. |
| e | The fifth stride. |
|
static |
Checks if a stride is aligned to a specified alignment.
| stride | The stride to check. |
| alignment | The alignment to check against. |
|
static |
Checks if a pointer is aligned to a specified alignment.
| pointer | The pointer to check. |
| alignment | The alignment to check against. |
|
static |
Allocates a block of memory.
| size | The number of bytes to allocate. |
| Exception | Thrown when the size is less than or equal to zero or exceeds the maximum allowed size. |
|
static |
Allocates a block of memory for a specified type.
| T | The type of the memory block to allocate. |
| T | : | unmanaged |
|
static |
Allocates and clears a block of memory.
| size | The number of bytes to allocate and clear. |
|
static |
Allocates and clears a block of memory for a specified type.
| T | The type of the memory block to allocate and clear. |
| T | : | unmanaged |
|
static |
Allocates and clears an array of memory blocks.
| stride | The size of each element in the array. |
| length | The number of elements in the array. |
|
static |
Allocates and clears an array of memory blocks for a specified type.
| T | The type of the elements in the array. |
| length | The number of elements in the array. |
| T | : | unmanaged |
|
static |
Allocates and clears an array of memory blocks for a specified type, ensuring a minimum length of 1.
| T | The type of the elements in the array. |
| length | The number of elements in the array. |
| T | : | unmanaged |
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates a block of memory and clears it.
|
static |
Allocates and clears an array of pointers for a specified type.
| T | The type of the elements in the array. |
| length | The number of elements in the array. |
| T | : | unmanaged |
|
static |
Allocates and clears an array of pointers for a specified type, ensuring a minimum length of 1.
| T | The type of the elements in the array. |
| length | The number of elements in the array. |
| T | : | unmanaged |
|
static |
Clears a block of memory by setting it to zero.
|
static |
Clears a block of memory by setting it to zero.
| ptr | The pointer to the memory block. |
| size | The number of bytes to clear. |
|
static |
Compares two blocks of memory.
| ptr1 | The first memory block pointer. |
| ptr2 | The second memory block pointer. |
| size | The number of bytes to compare. |
|
static |
Copies a block of memory from the source to the destination.
| destination | The destination pointer. |
| source | The source pointer. |
| size | The number of bytes to copy. |
|
static |
Copies memory quickly for specific sizes.
| d | The destination pointer. |
| s | The source pointer. |
| size | The number of bytes to copy. |
|
static |
Moves a block of memory from the source to the destination.
| destination | The destination pointer. |
| source | The source pointer. |
| size | The number of bytes to move. |
|
static |
Reads a length-prefixed UTF-8 encoded string from a memory location.
| source | The source pointer. |
| result | The resulting string. |
|
static |
Converts a reference to an unmanaged type to a pointer.
| T | The type of the object. |
| obj | The reference to the object. |
| T | : | unmanaged |
|
static |
Rounds the given number of bits up to the nearest multiple of 32.
| bits | The number of bits to round up. |
|
static |
Rounds the given number of bits up to the nearest multiple of 64.
| bits | The number of bits to round up. |
|
static |
Rounds a stride to a specified alignment.
| stride | The stride to round. |
| alignment | The alignment to apply. |
| InvalidOperationException | Thrown when the alignment is invalid. |
|
static |
Rounds a stride to a specified alignment.
| stride | The stride to round. |
| alignment | The alignment to apply. |
| InvalidOperationException | Thrown when the alignment is invalid. |
|
static |
Rounds a stride to the maximum alignment.
| stride | The stride to round. |
|
static |
Gets the size of the specified type.
| t | The type to get the size of. |
|
static |
Validates the block sentinels to ensure memory integrity.
| memory | The pointer to the memory block. |
| size | The size of the memory block. |
|
static |
Calculates the word count for a given stride and word size.
| stride | The stride to calculate. |
| wordSize | The size of each word. |
|
static |
Writes a length-prefixed UTF-8 encoded string to a memory location.
| destination | The destination pointer. |
| str | The string to encode and write. |
|
static |
The alignment size in bytes.
|
static |
The size of the cache line in bytes.