Reduce number of branches and IL size of string.Trim methods (#9115)
authorJustin Van Patten <jvp@justinvp.com>
Thu, 26 Jan 2017 05:30:02 +0000 (21:30 -0800)
committerJan Kotas <jkotas@microsoft.com>
Thu, 26 Jan 2017 05:30:02 +0000 (21:30 -0800)
src/mscorlib/src/System/String.Manipulation.cs

index 7b51abf..33de93f 100644 (file)
@@ -1556,7 +1556,7 @@ namespace System
             {
                 return TrimWhiteSpaceHelper(TrimType.Both);
             }
-            fixed (char* pTrimChars = trimChars)
+            fixed (char* pTrimChars = &trimChars[0])
             {
                 return TrimHelper(pTrimChars, trimChars.Length, TrimType.Both);
             }
@@ -1575,7 +1575,7 @@ namespace System
             {
                 return TrimWhiteSpaceHelper(TrimType.Head);
             }
-            fixed (char* pTrimChars = trimChars)
+            fixed (char* pTrimChars = &trimChars[0])
             {
                 return TrimHelper(pTrimChars, trimChars.Length, TrimType.Head);
             }
@@ -1594,7 +1594,7 @@ namespace System
             {
                 return TrimWhiteSpaceHelper(TrimType.Tail);
             }
-            fixed (char* pTrimChars = trimChars)
+            fixed (char* pTrimChars = &trimChars[0])
             {
                 return TrimHelper(pTrimChars, trimChars.Length, TrimType.Tail);
             }