Permalink
Browse files

AggressiveInlining AsBytes and NonPortableCast (#10057)

  • Loading branch information...
ahsonkhan authored and jkotas committed Mar 9, 2017
1 parent dd0dd22 commit 51a6b5ce75c853e77266b8e1ce8c264736d2aabe
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/mscorlib/src/System/Span.cs
@@ -426,6 +426,7 @@ public static class Span
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="T"/> contains pointers.
/// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Span<byte> AsBytes<T>(this Span<T> source)
where T : struct
{
@@ -445,6 +446,7 @@ public static Span<byte> AsBytes<T>(this Span<T> source)
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="T"/> contains pointers.
/// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> source)
where T : struct
{
@@ -467,6 +469,7 @@ public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> source)
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
/// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Span<TTo> NonPortableCast<TFrom, TTo>(this Span<TFrom> source)
where TFrom : struct
where TTo : struct
@@ -492,6 +495,7 @@ public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> source)
/// <exception cref="System.ArgumentException">
/// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
/// </exception>
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static ReadOnlySpan<TTo> NonPortableCast<TFrom, TTo>(this ReadOnlySpan<TFrom> source)
where TFrom : struct
where TTo : struct

0 comments on commit 51a6b5c

Please sign in to comment.