-
Notifications
You must be signed in to change notification settings - Fork 520
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[runtime] Remove internal memcpy p/invoke #8890
Conversation
* Replace `memcpy` with `Buffer.MemoryCopy` * Add cecil-based test to make sure we're not p/invoke into it again (nor any other MS banned API) * Remove `memcpy` from xtro ignore file
fixed (byte* arrAddr = &Maps[i].Value [0]) | ||
Runtime.memcpy (bufferEnd, (IntPtr) arrAddr, 128); | ||
fixed (void* arrAddr = &Maps[i].Value [0]) | ||
Buffer.MemoryCopy ((void*) bufferEnd, arrAddr, 128, 128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer.MemoryCopy has the source/destination parameters reversed wrt memcpy, but they're the same order here.
A simpler change would have been to implement Runtime.memcpy
using Buffer.MemoryCopy
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh, I wanted the name to disappear :)
Runtime.memcpy (bufferEnd, (IntPtr) arrAddr, controlsSize * connectionParams.NumControlTransforms); | ||
unsafe { | ||
fixed (void* arrAddr = &Controls[0]) | ||
Buffer.MemoryCopy ((void*) bufferEnd, arrAddr, controlsSize * connectionParams.NumControlTransforms, controlsSize * connectionParams.NumControlTransforms); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer.MemoryCopy has the source/destination parameters reversed wrt memcpy, but they're the same order here.
Build failure Test results1 tests failed, 87 tests passed.Failed tests
|
memcpy
withBuffer.MemoryCopy
memcpy
from xtro ignore file