public static void MemSet( [NotNull] this byte[] array, byte value ) {
if( array == null ) throw new ArgumentNullException( "array" );
byte[] rawValue = new[] { value, value, value, value, value, value, value, value };
Int64 fillValue = BitConverter.ToInt64( rawValue, 0 );
fixed( byte* ptr = array ) {
Int64* dest = (Int64*)ptr;
int length = array.Length;
while( length >= 8 ) {
*dest = fillValue;
dest++;
length -= 8;
}
byte* bDest = (byte*)dest;
for( byte i = 0; i < length; i++ ) {
*bDest = value;
bDest++;
}
}
}