10 [__DynamicallyInvokable]
26 [SecuritySafeCritical]
27 [__DynamicallyInvokable]
28 public static extern void BlockCopy(
Array src,
int srcOffset,
Array dst,
int dstOffset,
int count);
31 [SecuritySafeCritical]
32 internal static extern void InternalBlockCopy(
Array src,
int srcOffsetBytes,
Array dst,
int dstOffsetBytes,
int byteCount);
35 internal unsafe
static int IndexOfByte(
byte* src,
byte value,
int index,
int count)
38 for (ptr = src + index; ((int)ptr & 3) != 0; ptr++)
46 return (
int)(ptr - src);
50 uint num = (uint)((value << 8) + value);
51 num = (num << 16) + num;
54 uint num2 = *(uint*)ptr;
56 uint num3 = 2130640639 + num2;
57 num2 = (uint)((
int)num2 ^ -1);
59 if (((
int)num2 & -2130640640) != 0)
61 int num4 = (int)(ptr - src);
86 return (
int)(ptr - src);
96 private static extern bool IsPrimitiveTypeArray(
Array array);
100 private static extern byte _GetByte(
Array array,
int index);
114 [SecuritySafeCritical]
115 [__DynamicallyInvokable]
122 if (!IsPrimitiveTypeArray(array))
126 if (index < 0 || index >= _ByteLength(array))
130 return _GetByte(array, index);
135 private static extern void _SetByte(
Array array,
int index,
byte value);
149 [SecuritySafeCritical]
150 [__DynamicallyInvokable]
157 if (!IsPrimitiveTypeArray(array))
161 if (index < 0 || index >= _ByteLength(array))
165 _SetByte(array, index, value);
170 private static extern int _ByteLength(
Array array);
181 [SecuritySafeCritical]
182 [__DynamicallyInvokable]
189 if (!IsPrimitiveTypeArray(array))
193 return _ByteLength(array);
197 internal unsafe
static void ZeroMemory(
byte* src,
long len)
213 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
214 internal unsafe
static void Memcpy(
byte[] dest,
int destIndex,
byte* src,
int srcIndex,
int len)
218 fixed (
byte* ptr = dest)
220 Memcpy(ptr + destIndex, src + srcIndex, len);
226 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
227 internal unsafe
static void Memcpy(
byte* pDest,
int destIndex,
byte[] src,
int srcIndex,
int len)
231 fixed (
byte* ptr = src)
233 Memcpy(pDest + destIndex, ptr + srcIndex, len);
239 [FriendAccessAllowed]
241 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
242 internal unsafe
static void Memcpy(
byte* dest,
byte* src,
int len)
244 Memmove(dest, src, (uint)len);
248 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
249 internal unsafe
static void Memmove(
byte* dest,
byte* src, ulong len)
251 if ((ulong)((
long)dest - (
long)src) >= len)
264 *(
short*)dest = *(
short*)src;
267 *(
short*)dest = *(
short*)src;
271 *(
int*)dest = *(
int*)src;
274 *(
int*)dest = *(
int*)src;
278 *(
int*)dest = *(
int*)src;
279 *(
short*)(dest + 4) = *(
short*)(src + 4);
282 *(
int*)dest = *(
int*)src;
283 *(
short*)(dest + 4) = *(
short*)(src + 4);
287 *(
long*)dest = *(
long*)src;
290 *(
long*)dest = *(
long*)src;
294 *(
long*)dest = *(
long*)src;
295 *(
short*)(dest + 8) = *(
short*)(src + 8);
298 *(
long*)dest = *(
long*)src;
299 *(
short*)(dest + 8) = *(
short*)(src + 8);
303 *(
long*)dest = *(
long*)src;
304 *(
int*)(dest + 8) = *(
int*)(src + 8);
307 *(
long*)dest = *(
long*)src;
308 *(
int*)(dest + 8) = *(
int*)(src + 8);
312 *(
long*)dest = *(
long*)src;
313 *(
int*)(dest + 8) = *(
int*)(src + 8);
314 *(
short*)(dest + 12) = *(
short*)(src + 12);
317 *(
long*)dest = *(
long*)src;
318 *(
int*)(dest + 8) = *(
int*)(src + 8);
319 *(
short*)(dest + 12) = *(
short*)(src + 12);
323 *(
long*)dest = *(
long*)src;
324 *(
long*)(dest + 8) = *(
long*)(src + 8);
330 if (((
int)dest & 3) != 0)
332 if (((
int)dest & 1) != 0)
338 if (((
int)dest & 2) == 0)
343 *(
short*)dest = *(
short*)src;
351 _Memmove(dest, src, len);
354 if (((
int)dest & 4) != 0)
356 *(
int*)dest = *(
int*)src;
361 for (ulong num2 = len / 16uL; num2 != 0; num2--)
363 *(
long*)dest = *(
long*)src;
364 *(
long*)(dest + 8) = *(
long*)(src + 8);
370 *(
long*)dest = *(
long*)src;
376 *(
int*)dest = *(
int*)src;
382 *(
short*)dest = *(
short*)src;
394 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
395 private unsafe
static void _Memmove(
byte* dest,
byte* src, ulong len)
397 __Memmove(dest, src, len);
401 [SuppressUnmanagedCodeSecurity]
403 [ReliabilityContract(
Consistency.WillNotCorruptState,
Cer.Success)]
404 private unsafe
static extern void __Memmove(
byte* dest,
byte* src, ulong len);
415 [CLSCompliant(
false)]
416 public unsafe
static void MemoryCopy(
void* source,
void* destination,
long destinationSizeInBytes,
long sourceBytesToCopy)
418 if (sourceBytesToCopy > destinationSizeInBytes)
420 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sourceBytesToCopy);
422 Memmove((
byte*)destination, (
byte*)source, checked((ulong)sourceBytesToCopy));
434 [CLSCompliant(
false)]
435 public unsafe
static void MemoryCopy(
void* source,
void* destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy)
437 if (sourceBytesToCopy > destinationSizeInBytes)
439 ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.sourceBytesToCopy);
441 Memmove((
byte*)destination, (
byte*)source, sourceBytesToCopy);
static unsafe void MemoryCopy(void *source, void *destination, ulong destinationSizeInBytes, ulong sourceBytesToCopy)
Copies a number of bytes specified as an unsigned long integer value from one address in memory to an...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
The exception that is thrown when the value of an argument is outside the allowable range of values a...
static void SetByte(Array array, int index, byte value)
Assigns a specified value to a byte at a particular location in a specified array.
Cer
Specifies a method's behavior when called within a constrained execution region.
Provides information about, and means to manipulate, the current environment and platform....
static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count)
Copies a specified number of bytes from a source array starting at a particular offset to a destinati...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
MethodImplOptions
Defines the details of how a method is implemented.
CharSet
Dictates which character set marshaled strings should use.
static int ByteLength(Array array)
Returns the number of bytes in the specified array.
static byte GetByte(Array array, int index)
Retrieves the byte at a specified location in a specified array.
The exception that is thrown when one of the arguments provided to a method is not valid.
Manipulates arrays of primitive types.
Consistency
Specifies a reliability contract.
static unsafe void MemoryCopy(void *source, void *destination, long destinationSizeInBytes, long sourceBytesToCopy)
Copies a number of bytes specified as a long integer value from one address in memory to another....