-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement IUtf8SpanFormattable on all the numeric types in corelib (#…
…84587) * Implement IUtf8SpanFormattable on all the numeric types in corelib Augments SByte, Byte, Int16, UInt16, Int32, UInt32, Int64, UInt64, IntPtr, UIntPtr, Int128, UInt128, Half, Single, Double, NFloat, and Decimal. Also fixes corelib TODOs around using IUtf8SpanFormattable. And removes some duplicate code from Utf8Formatter. There is still more consolidation to be done between FormattingHelpers and Number.Formatting. * Address regressions from previous formatting changes - Use an internal interface implemented by char and byte to have dedicated CastFrom methods that are always inlineable due to very small size. - Use pointers in some core formatting routines to avoid needing bulky IL for manipulating refs with spans, making various members more inlineable. - Avoid Encoding.UTF8.GetBytes in various code paths by caching more UTF8 sequences on DateTimeFormatInfo and NumberFormatInfo - Change FormatCustomizedTimeZone to special-case 2 vs 3+ tokens in order to avoid extra AppendSpan calls - Fix growth logic in ValueListBuilder to not forcibly grow more than is needed - Inline ValueListBuilder.AppendSpan and remove some bounds checks (at least on 64-bit) - Change FormatDigits to special-case lengths of 1/2/4 and to use existing formatting routines rather than a custom one - Remove the FormatDigits wrapper overload and just have all calls go to the main workhorse method. - Remove the use of "..."u8 in R/O formatting that leads to needing to use additional span-based helpers. The minimal gain on coreclr isn't worth the extra complication - Changed some switches to include half the cases based on lowercasing the ASCII input char - Moved Date/TimeOnly charsWritten into Try method to be closer to the source of truth rather than having the value far aware (this isn't for perf and could possibly even be a microregression, so I included it here to ensure it's not measurable). * Remove mono ifdef in WriteTwo/FourDigits
- Loading branch information
1 parent
3d97f41
commit ed09ae5
Showing
77 changed files
with
1,967 additions
and
3,024 deletions.
There are no files selected for viewing
34 changes: 0 additions & 34 deletions
34
src/libraries/System.Memory/tests/ParsersAndFormatters/Formatter/FormatterTests.Negative.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.