diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs index 6316a19b33559e..991ba2448451c7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/FormattingHelpers.cs @@ -33,19 +33,6 @@ public static char GetSymbolOrDefault(in StandardFormat format, char defaultSymb #region UTF-8 Helper methods - /// - /// Fills a buffer with the ASCII character '0' (0x30). - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void FillWithAsciiZeros(Span buffer) - { - // This is a faster implementation of Span.Fill(). - for (int i = 0; i < buffer.Length; i++) - { - buffer[i] = (byte)'0'; - } - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteDigits(ulong value, Span buffer) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.D.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.D.cs index 2a2059674f9163..c449b3341af840 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.D.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.D.cs @@ -43,7 +43,8 @@ private static bool TryFormatUInt64D(ulong value, byte precision, Span des if (leadingZeroCount > 0) { - FormattingHelpers.FillWithAsciiZeros(destination.Slice(0, leadingZeroCount)); + // Fill with ASCII zeros + destination.Slice(0, leadingZeroCount).Fill((byte)'0'); } FormattingHelpers.WriteDigits(value, destination.Slice(leadingZeroCount, digitCount)); diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.N.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.N.cs index c7f564ae6c9f60..f28935a197758d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.N.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Text/Utf8Formatter/Utf8Formatter.Integer.Unsigned.N.cs @@ -48,7 +48,9 @@ private static bool TryFormatUInt64N(ulong value, byte precision, Span des if (trailingZeroCount > 0) { destination[digitCount + commaCount] = Utf8Constants.Period; - FormattingHelpers.FillWithAsciiZeros(destination.Slice(digitCount + commaCount + 1, trailingZeroCount)); + + // Fill with ASCII zeros + destination.Slice(digitCount + commaCount + 1, trailingZeroCount).Fill((byte)'0'); } return true;