AggressiveInlining AsBytes and NonPortableCast (dotnet/coreclr#10057)
authorAhson Ahmed Khan <ahsonkhan@users.noreply.github.com>
Thu, 9 Mar 2017 14:45:45 +0000 (06:45 -0800)
committerJan Kotas <jkotas@microsoft.com>
Thu, 9 Mar 2017 14:45:45 +0000 (06:45 -0800)
Commit migrated from https://github.com/dotnet/coreclr/commit/51a6b5ce75c853e77266b8e1ce8c264736d2aabe

src/coreclr/src/mscorlib/src/System/Span.cs

index 8fa85cc..5c3b5e0 100644 (file)
@@ -426,6 +426,7 @@ namespace System
         /// <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 @@ namespace System
         /// <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 @@ namespace System
         /// <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 @@ namespace System
         /// <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