Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corefx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAhson Khan <ahkha@microsoft.com>2018-03-26 08:19:11 +0300
committerGitHub <noreply@github.com>2018-03-26 08:19:11 +0300
commit008c119440aa5219cc3c274a3a1edfa8c21711f3 (patch)
tree9d13e08a33aaa86cdb5324e715b5d3767dab86fd /src/System.Memory/tests
parent6ca628df3b5fff79ab6fc19259ac9078e3fbd3a1 (diff)
Update uses of AsBytes to use MemoryMarshal.AsBytes (#28460)
* Update uses of AsBytes to use MemoryMarshal.AsBytes * Cleanup commented out code * Remove AsBytes from MemoryExtensions Portable
Diffstat (limited to 'src/System.Memory/tests')
-rw-r--r--src/System.Memory/tests/Performance/Perf.Span.IndexOf.cs5
-rw-r--r--src/System.Memory/tests/Performance/Perf.Span.IndexOfAny.cs11
2 files changed, 9 insertions, 7 deletions
diff --git a/src/System.Memory/tests/Performance/Perf.Span.IndexOf.cs b/src/System.Memory/tests/Performance/Perf.Span.IndexOf.cs
index dd678920f4..b260183cc3 100644
--- a/src/System.Memory/tests/Performance/Perf.Span.IndexOf.cs
+++ b/src/System.Memory/tests/Performance/Perf.Span.IndexOf.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Runtime.InteropServices;
using Microsoft.Xunit.Performance;
using Xunit;
@@ -44,7 +45,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
int index = 0;
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
@@ -120,7 +121,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
int index = 0;
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
diff --git a/src/System.Memory/tests/Performance/Perf.Span.IndexOfAny.cs b/src/System.Memory/tests/Performance/Perf.Span.IndexOfAny.cs
index 26c5f5bf95..f4a78276f5 100644
--- a/src/System.Memory/tests/Performance/Perf.Span.IndexOfAny.cs
+++ b/src/System.Memory/tests/Performance/Perf.Span.IndexOfAny.cs
@@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
+using System.Runtime.InteropServices;
using Microsoft.Xunit.Performance;
using Xunit;
@@ -44,7 +45,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
int index = 0;
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
@@ -118,7 +119,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
int index = 0;
foreach (BenchmarkIteration iteration in Benchmark.Iterations)
@@ -193,7 +194,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
ReadOnlySpan<byte> values = new ReadOnlySpan<byte>(new byte[] { 53, 54, 55, 56 }); // '5' = 53
int index = 0;
@@ -219,7 +220,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
ReadOnlySpan<byte> values = new ReadOnlySpan<byte>(new byte[] { 54, 55, 56, 57 }); // '5' = 53
int index = 0;
@@ -245,7 +246,7 @@ namespace System.Memory.Tests
{
Span<char> charSpan = new char[size];
charSpan[size / 2] = '5';
- Span<byte> byteSpan = charSpan.AsBytes();
+ Span<byte> byteSpan = MemoryMarshal.AsBytes(charSpan);
ReadOnlySpan<byte> values = new ReadOnlySpan<byte>(new byte[] { 54, 55, 56, 53 }); // '5' = 53
int index = 0;