Imported Upstream version 5.14.0.78

Former-commit-id: 3494343bcc9ddb42b36b82dd9ae7b69e85e0229f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-05-10 08:37:03 +00:00
parent 74b74abd9f
commit 19234507ba
1776 changed files with 67755 additions and 31107 deletions

View File

@ -181,34 +181,39 @@ namespace System
((byte*)dest) [0] = ((byte*)src) [0];
}
internal static unsafe void Memcpy (byte *dest, byte *src, int size) {
internal static unsafe void Memcpy (byte *dest, byte *src, int len) {
// FIXME: if pointers are not aligned, try to align them
// so a faster routine can be used. Handle the case where
// the pointers can't be reduced to have the same alignment
// (just ignore the issue on x86?)
if ((((int)dest | (int)src) & 3) != 0) {
if (((int)dest & 1) != 0 && ((int)src & 1) != 0 && size >= 1) {
if (((int)dest & 1) != 0 && ((int)src & 1) != 0 && len >= 1) {
dest [0] = src [0];
++dest;
++src;
--size;
--len;
}
if (((int)dest & 2) != 0 && ((int)src & 2) != 0 && size >= 2) {
if (((int)dest & 2) != 0 && ((int)src & 2) != 0 && len >= 2) {
((short*)dest) [0] = ((short*)src) [0];
dest += 2;
src += 2;
size -= 2;
len -= 2;
}
if ((((int)dest | (int)src) & 1) != 0) {
memcpy1 (dest, src, size);
memcpy1 (dest, src, len);
return;
}
if ((((int)dest | (int)src) & 2) != 0) {
memcpy2 (dest, src, size);
memcpy2 (dest, src, len);
return;
}
}
memcpy4 (dest, src, size);
memcpy4 (dest, src, len);
}
internal static unsafe void Memmove (byte *dest, byte *src, uint len)
{
Memcpy (dest, src, (int) len);
}
}
}