summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPent Ploompuu <kaalikas@gmail.com>2018-06-01 03:02:45 (GMT)
committerJan Kotas <jkotas@microsoft.com>2018-06-27 13:14:47 (GMT)
commit373b10e0edf959665d9fdaf312b3dceb8cedbe81 (patch)
tree36cdd0c75913f34f494751e6889d4f181d32b428 /src
parent2b283f380dac7834421a5dd979fdcc0b6e898607 (diff)
downloadcoreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.zip
coreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.tar.gz
coreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.tar.bz2
Fix SpanHelpers.ClearWithoutReferences alignment detection (#18222)
Diffstat (limited to 'src')
-rw-r--r--src/mscorlib/shared/System/SpanHelpers.cs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mscorlib/shared/System/SpanHelpers.cs b/src/mscorlib/shared/System/SpanHelpers.cs
index c3cfe5a..07bbda6 100644
--- a/src/mscorlib/shared/System/SpanHelpers.cs
+++ b/src/mscorlib/shared/System/SpanHelpers.cs
@@ -355,13 +355,13 @@ namespace System
nuint i = 0; // byte offset at which we're copying
- if ((Unsafe.As<byte, int>(ref b) & 3) != 0)
+ if (((nuint)Unsafe.AsPointer(ref b) & 3) != 0)
{
- if ((Unsafe.As<byte, int>(ref b) & 1) != 0)
+ if (((nuint)Unsafe.AsPointer(ref b) & 1) != 0)
{
- Unsafe.AddByteOffset<byte>(ref b, i) = 0;
+ b = 0;
i += 1;
- if ((Unsafe.As<byte, int>(ref b) & 2) != 0)
+ if (((nuint)Unsafe.AsPointer(ref b) & 2) != 0)
goto IntAligned;
}
Unsafe.As<byte, short>(ref Unsafe.AddByteOffset<byte>(ref b, i)) = 0;
@@ -378,7 +378,7 @@ namespace System
// The thing 1, 2, 3, and 4 have in common that the others don't is that if you
// subtract one from them, their 3rd lsb will not be set. Hence, the below check.
- if (((Unsafe.As<byte, int>(ref b) - 1) & 4) == 0)
+ if ((((nuint)Unsafe.AsPointer(ref b) - 1) & 4) == 0)
{
Unsafe.As<byte, int>(ref Unsafe.AddByteOffset<byte>(ref b, i)) = 0;
i += 4;