Skip to content

Commit

Permalink
Remove range check in VSB.Append(char) (#82264)
Browse files Browse the repository at this point in the history
  • Loading branch information
MihaZupan authored Feb 17, 2023
1 parent d32b27a commit a9dcf99
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libraries/Common/src/System/Text/ValueStringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,10 @@ public void Insert(int index, string? s)
public void Append(char c)
{
int pos = _pos;
if ((uint)pos < (uint)_chars.Length)
Span<char> chars = _chars;
if ((uint)pos < (uint)chars.Length)
{
_chars[pos] = c;
chars[pos] = c;
_pos = pos + 1;
}
else
Expand Down

0 comments on commit a9dcf99

Please sign in to comment.