-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unify formatting part of BigInteger of CoreLib #97889
Conversation
This reverts commit bcc70e3.
Tagging subscribers to this area: @dotnet/area-system-numerics |
Thanks for continuing the work/effort here! I'll try to get this reviewed in the next week or so, but as you know there's a few different BigInteger PRs still pending going in, so we'll see where it ends up. |
182ffaa
to
563dd5d
Compare
Splitting optimization to another PR to make this easier. I don't want this to be blocked (and blocking for others) for longer period. Edit: I'm probably unable to complete this before vacation. |
|
||
internal static unsafe void NumberToString<TChar>(ref ValueListBuilder<TChar> vlb, ref NumberBuffer number, char format, int nMaxDigits, NumberFormatInfo info) where TChar : unmanaged, IUtfChar<TChar> | ||
{ | ||
Debug.Assert(typeof(TChar) == typeof(char) || typeof(TChar) == typeof(byte)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert is painful for polyfill. How about switching to sizeof
?
IBinaryInteger
provides similar performance with IUtfChar
on CLR, but on mono it may cause regression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is it painful, I'm not understanding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
S.R.Numerics can't call these methods with byte or char directly, but a polyfill type that implements an internal definition of IUtfChar instead. I have done this in previous PR. There's no such type check in parsing logic.
Tests are passing locally. The adapting of this PR is unoptimized to simplify the reviewing. |
@huoyaoyuan, there's a conflict here. This otherwise looks good to me so I'll finish my last pass and merge if CI passes after the conflict is resolved |
Conflicts resolved. |
Another part of #28657, in continuation of #85978 and #95402.
It's 2.5 years from my initial attempt on this, and more than half a year for code in this PR.