c# - Copy multi dimension array fast -
i have following code , want know fastest way copy _zobrist
, _hashenpassant
arrays?
internal void inithash() { int32 i; ( = 0; < 2; i++ ) ( int32 j = 0; j < 6; j++ ) ( int32 k = 0; k < 64; k++ ) _zobrist[ i, j, k ] = hashrand(); ( = 0; < 64; ++i ) _hashenpassant[ ] = hashrand(); }
the reason chess engine creates multiple analysis boards , rather recreating new boards scratch clone existing board. issue having calling inithash()
method or doing simple copy slow.
i have looked @ this , not sure how modify work uint64 types.
from here: http://msdn.microsoft.com/en-us/library/z50k9bft%28v=vs.110%29.aspx
if looks need copy total number of elements in array using array.com
array.copy( myobjarray, 0, myintarray, 0, numelements );
numelements 2*6*64?
just show api declaration website , values use:
public static void copy( array sourcearray, int sourceindex, array destinationarray, int destinationindex, int length )
values:
sourceindex = 0 destinationindex = 0 length = x*y*z (array dimension lengths)
Comments
Post a Comment