C# - Fast Memory Copy Method with x86 Assembly Usage

added by Paul Wheeler
12/22/2014 2:02:08 PM

1 Kicks, 593 Views

How to use ASM in C#.NET and most fast memory copy method


1 comments

Thomas Levesque
12/22/2014 4:23:23 PM
Don't use that code as is, it's not safe. It will fail if the GC moves the array in the middle of the copy. The array must be pinned before using UnsafeAddrOfPinnedArrayElement. Anyway, a better and easier option is to leverage the cpblk IL instruction with Reflection.Emit