From 8ec9bdfd53220b555f0b19eebd6a2c4ab5dab8bf Mon Sep 17 00:00:00 2001 From: Ahson Khan Date: Fri, 15 Dec 2017 22:36:38 -0800 Subject: Convert uses of the Dangerous APIs to use MemoryMarshal.GetReference (#15532) * Convert uses of the Dangerous APIs to use MemoryMarshal.GetReference * Adding Unsafe.AsRef(in...) and using that for ReadOnlySpan GetReference * Fix typo - add missing bracket. * Change AsRef(ref...) to AsRef(in...) * Remove unnecessary whitespace * Remove Unsafe.AsRef(in...) and its uses. * Revert "Remove unnecessary whitespace" This reverts commit 4dbe38cae472e868f74afbabde358f3a7609f6ae. * Revert "Revert "Remove unnecessary whitespace"" This reverts commit 44d79483423ac9ffcf7c566b79d4a42c6aa15dac. * Remove extra space to fix formatting. --- tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs index 63f59e04be..82583ad1e2 100644 --- a/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs +++ b/tests/src/JIT/Performance/CodeQuality/Span/Indexer.cs @@ -67,7 +67,7 @@ namespace Span [MethodImpl(MethodImplOptions.NoInlining)] static byte TestRef(Span data) { - ref byte p = ref data.DangerousGetPinnableReference(); + ref byte p = ref MemoryMarshal.GetReference(data); int length = data.Length; byte x = 0; @@ -102,7 +102,7 @@ namespace Span [MethodImpl(MethodImplOptions.NoInlining)] static unsafe byte TestFixed1(Span data) { - fixed (byte* pData = &data.DangerousGetPinnableReference()) + fixed (byte* pData = &MemoryMarshal.GetReference(data)) { int length = data.Length; byte x = 0; @@ -140,7 +140,7 @@ namespace Span [MethodImpl(MethodImplOptions.NoInlining)] static unsafe byte TestFixed2(Span data) { - fixed (byte* pData = &data.DangerousGetPinnableReference()) + fixed (byte* pData = &MemoryMarshal.GetReference(data)) { int length = data.Length; byte x = 0; -- cgit v1.2.3