diff options
author | Jan Kotas <jkotas@microsoft.com> | 2018-03-31 00:30:53 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-31 00:30:53 -0700 |
commit | 3632a515eccbba14e9393d83683f39e94690f42b (patch) | |
tree | 6d452617c980d4d6e7ebebc340cb7122a3387b49 /src | |
parent | c05eeefbb63cf7f9a466a7371bd44d3254806f03 (diff) | |
download | coreclr-3632a515eccbba14e9393d83683f39e94690f42b.tar.gz coreclr-3632a515eccbba14e9393d83683f39e94690f42b.tar.bz2 coreclr-3632a515eccbba14e9393d83683f39e94690f42b.zip |
Make AsSpan(this string) ForceInline to be on par with AsSpan(this T[]) (#17368)
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/shared/System/MemoryExtensions.Fast.cs | 4 | ||||
-rw-r--r-- | src/mscorlib/shared/System/MemoryExtensions.cs | 10 | ||||
-rw-r--r-- | src/mscorlib/shared/System/String.cs | 1 |
3 files changed, 9 insertions, 6 deletions
diff --git a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs index d9e3af8804..d256887a9f 100644 --- a/src/mscorlib/shared/System/MemoryExtensions.Fast.cs +++ b/src/mscorlib/shared/System/MemoryExtensions.Fast.cs @@ -359,6 +359,7 @@ namespace System /// <summary> /// Creates a new span over the portion of the target array. /// </summary> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Span<T> AsSpan<T>(this T[] array, int start) { if (array == null) @@ -380,6 +381,7 @@ namespace System /// </summary> /// <param name="text">The target string.</param> /// <remarks>Returns default when <paramref name="text"/> is null.</remarks> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<char> AsSpan(this string text) { if (text == null) @@ -397,6 +399,7 @@ namespace System /// <exception cref="System.ArgumentOutOfRangeException"> /// Thrown when the specified <paramref name="start"/> index is not in range (<0 or >text.Length). /// </exception> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<char> AsSpan(this string text, int start) { if (text == null) @@ -422,6 +425,7 @@ namespace System /// <exception cref="System.ArgumentOutOfRangeException"> /// Thrown when the specified <paramref name="start"/> index or <paramref name="length"/> is not in range. /// </exception> + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<char> AsSpan(this string text, int start, int length) { if (text == null) diff --git a/src/mscorlib/shared/System/MemoryExtensions.cs b/src/mscorlib/shared/System/MemoryExtensions.cs index 1a3b33acc7..c3e1cd51fa 100644 --- a/src/mscorlib/shared/System/MemoryExtensions.cs +++ b/src/mscorlib/shared/System/MemoryExtensions.cs @@ -68,7 +68,6 @@ namespace System /// </summary> /// <param name="span">The source span from which the character is removed.</param> /// <param name="trimChar">The specified character to look for and remove.</param> - //[MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<char> Trim(this ReadOnlySpan<char> span, char trimChar) { return span.TrimStart(trimChar).TrimEnd(trimChar); @@ -79,7 +78,6 @@ namespace System /// </summary> /// <param name="span">The source span from which the character is removed.</param> /// <param name="trimChar">The specified character to look for and remove.</param> - //[MethodImpl(MethodImplOptions.AggressiveInlining)] public static ReadOnlySpan<char> TrimStart(this ReadOnlySpan<char> span, char trimChar) { int start = 0; @@ -1204,7 +1202,7 @@ namespace System /// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>. /// </returns> /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name = "comparable" /> is <see langword="null"/> . + /// <paramref name = "comparable" /> is <see langword="null"/> . /// </exception> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BinarySearch<T>( @@ -1228,7 +1226,7 @@ namespace System /// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>. /// </returns> /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name = "comparable" /> is <see langword="null"/> . + /// <paramref name = "comparable" /> is <see langword="null"/> . /// </exception> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BinarySearch<T, TComparable>( @@ -1278,7 +1276,7 @@ namespace System /// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>. /// </returns> /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name = "comparable" /> is <see langword="null"/> . + /// <paramref name = "comparable" /> is <see langword="null"/> . /// </exception> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BinarySearch<T>( @@ -1302,7 +1300,7 @@ namespace System /// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>. /// </returns> /// <exception cref="T:System.ArgumentNullException"> - /// <paramref name = "comparable" /> is <see langword="null"/> . + /// <paramref name = "comparable" /> is <see langword="null"/> . /// </exception> [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int BinarySearch<T, TComparable>( diff --git a/src/mscorlib/shared/System/String.cs b/src/mscorlib/shared/System/String.cs index a1251d6be0..42d21ba068 100644 --- a/src/mscorlib/shared/System/String.cs +++ b/src/mscorlib/shared/System/String.cs @@ -360,6 +360,7 @@ namespace System return result; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] public static implicit operator ReadOnlySpan<char>(string value) => value != null ? new ReadOnlySpan<char>(ref value.GetRawStringData(), value.Length) : default; |