From fccff6eadb6ae97c8f53e570c3996c46a915b545 Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Wed, 31 Aug 2022 17:26:41 -0700 Subject: [PATCH] Revert change in StringBuilder.Append(char) (#74885) The change has a bad interaction with inlining heuristics. Fixes #74158. Partial revert of #67448. --- .../System.Private.CoreLib/src/System/Text/StringBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs index ba233dc62aade..1c0c6f493b033 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs @@ -1052,10 +1052,10 @@ public StringBuilder Append(char value) int nextCharIndex = m_ChunkLength; char[] chars = m_ChunkChars; - if ((uint)nextCharIndex < (uint)chars.Length) + if ((uint)chars.Length > (uint)nextCharIndex) { chars[nextCharIndex] = value; - m_ChunkLength = nextCharIndex + 1; + m_ChunkLength++; } else {