A* Pathfinding Project  3.8.5
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
Memory Class Reference

Static Public Member Functions

static void MemSet (byte[] array, byte value)
 Sets all values in an array to a specific value faster than a loop.
 
static void MemSet< T > (T[] array, T value, int byteSize)
 Sets all values in an array to a specific value faster than a loop.
 
static void MemSet< T > (T[] array, T value, int totalSize, int byteSize)
 Sets all values in an array to a specific value faster than a loop.
 

Member Function Documentation

static void MemSet ( byte[]  array,
byte  value 
)
static

Sets all values in an array to a specific value faster than a loop.

Only faster for large arrays. Slower for small ones. Tests indicate it becomes faster somewhere when the length of the array grows above around 100. For large arrays this can be magnitudes faster. Up to 40 times faster has been measured.

See Also
System.Buffer.BlockCopy
static void MemSet< T > ( T[]  array,
value,
int  byteSize 
)
static

Sets all values in an array to a specific value faster than a loop.

Only faster for large arrays. Slower for small ones. Tests indicate it becomes faster somewhere when the length of the array grows above around 100. For large arrays this can be magnitudes faster. Up to 40 times faster has been measured.

Note
Only works on primitive value types such as int, long, float, etc.
Parameters
arraythe array to fill
valuethe value to fill the array with
byteSizesize in bytes of every element in the array. e.g 4 bytes for an int, or 8 bytes for a long. It can be efficiently got using the sizeof built-in function.
//Set all values to 8 in the array
int[] arr = new int[20000];
Pathfinding.Util.Memory.MemSet<int> (arr, 8, sizeof(int));
See Also
System.Buffer.BlockCopy
Type Constraints
T :struct 
static void MemSet< T > ( T[]  array,
value,
int  totalSize,
int  byteSize 
)
static

Sets all values in an array to a specific value faster than a loop.

Only faster for large arrays. Slower for small ones. Tests indicate it becomes faster somewhere when the length of the array grows above around 100. For large arrays this can be magnitudes faster. Up to 40 times faster has been measured.

Note
Only works on primitive value types such as int, long, float, etc.
Parameters
arraythe array to fill
valuethe value to fill the array with
byteSizesize in bytes of every element in the array. e.g 4 bytes for an int, or 8 bytes for a long.
totalSizeall indices in the range [0, totalSize-1] will be set

It can be efficiently got using the sizeof built-in function.

//Set all values to 8 in the array
int[] arr = new int[20000];
Pathfinding.Util.Memory.MemSet<int> (arr, 8, sizeof(int));
See Also
System.Buffer.BlockCopy
Type Constraints
T :struct 

The documentation for this class was generated from the following file: