diff options
author | Pent Ploompuu <kaalikas@gmail.com> | 2018-06-01 06:02:45 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2018-06-27 06:14:47 -0700 |
commit | 373b10e0edf959665d9fdaf312b3dceb8cedbe81 (patch) | |
tree | 36cdd0c75913f34f494751e6889d4f181d32b428 | |
parent | 2b283f380dac7834421a5dd979fdcc0b6e898607 (diff) | |
download | coreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.tar.gz coreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.tar.bz2 coreclr-373b10e0edf959665d9fdaf312b3dceb8cedbe81.zip |
Fix SpanHelpers.ClearWithoutReferences alignment detection (#18222)
-rw-r--r-- | src/mscorlib/shared/System/SpanHelpers.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mscorlib/shared/System/SpanHelpers.cs b/src/mscorlib/shared/System/SpanHelpers.cs index c3cfe5a071..07bbda6a67 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; |