diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-03-27 00:31:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-27 00:31:55 -0700 |
commit | 463e296f9dd7cad2f1dc76fa4572e83af3cc0d22 (patch) | |
tree | 5a24f31fb4475cec837b434d9dd086734b3abb5d /src/mscorlib/shared | |
parent | 9e078ffab41899650419a5928832a4302b6881e0 (diff) | |
download | coreclr-463e296f9dd7cad2f1dc76fa4572e83af3cc0d22.tar.gz coreclr-463e296f9dd7cad2f1dc76fa4572e83af3cc0d22.tar.bz2 coreclr-463e296f9dd7cad2f1dc76fa4572e83af3cc0d22.zip |
Delete MemoryExtensions.AsBytes (#17245)
Moved to MemoryMarshal
Diffstat (limited to 'src/mscorlib/shared')
-rw-r--r-- | src/mscorlib/shared/System/MemoryExtensions.Fast.cs | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs index a814d4fb20..d9e3af8804 100644 --- a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs +++ b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs @@ -357,52 +357,6 @@ namespace System } /// <summary> - /// Casts a Span of one primitive type <typeparamref name="T"/> to Span of bytes. - /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety. - /// </summary> - /// <param name="span">The source slice, of type <typeparamref name="T"/>.</param> - /// <exception cref="System.ArgumentException"> - /// Thrown when <typeparamref name="T"/> contains pointers. - /// </exception> - /// <exception cref="System.OverflowException"> - /// Thrown if the Length property of the new Span would exceed Int32.MaxValue. - /// </exception> - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Span<byte> AsBytes<T>(this Span<T> span) - where T : struct - { - if (RuntimeHelpers.IsReferenceOrContainsReferences<T>()) - ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T)); - - return new Span<byte>( - ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), - checked(span.Length * Unsafe.SizeOf<T>())); - } - - /// <summary> - /// Casts a ReadOnlySpan of one primitive type <typeparamref name="T"/> to ReadOnlySpan of bytes. - /// That type may not contain pointers or references. This is checked at runtime in order to preserve type safety. - /// </summary> - /// <param name="span">The source slice, of type <typeparamref name="T"/>.</param> - /// <exception cref="System.ArgumentException"> - /// Thrown when <typeparamref name="T"/> contains pointers. - /// </exception> - /// <exception cref="System.OverflowException"> - /// Thrown if the Length property of the new Span would exceed Int32.MaxValue. - /// </exception> - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> span) - where T : struct - { - if (RuntimeHelpers.IsReferenceOrContainsReferences<T>()) - ThrowHelper.ThrowInvalidTypeWithPointersNotSupported(typeof(T)); - - return new ReadOnlySpan<byte>( - ref Unsafe.As<T, byte>(ref MemoryMarshal.GetReference(span)), - checked(span.Length * Unsafe.SizeOf<T>())); - } - - /// <summary> /// Creates a new span over the portion of the target array. /// </summary> public static Span<T> AsSpan<T>(this T[] array, int start) |