Repository navigation
Optimize Decimal.Remainder - #5926
Conversation
It think so. In may be useful for clarify to use explicit |
| d1.uflags = (d1.uflags & ~SignMask) | (d2.uflags & SignMask); | ||
| } | ||
| Decimal tmp = d2; | ||
| DecAddSub(ref d1, ref tmp, true); |
There was a problem hiding this comment.
Nit: DecAddSub trashing the second argument is non-intuitive ... it may be useful to add comment about it in front of DecAddSub at least.
There was a problem hiding this comment.
And in the readonly decimal, use ref for arguments that can be trashed; and in for arguments that stay intact?
There was a problem hiding this comment.
I'll add comments for parameter trashing and use in where possible (can't use in for mutable structs because property calls would require implicit local copies).
|
I added new tests that cover all |
|
Is fixing it just about changing the scale from 27 to 28? I think it would be easier to fix it. |
|
The fix is in dotnet/coreclr#18424 and I updated tests also (tests will fail until until CoreCLR update, NETFX is excluded). |
In addition to better performance this contributes to making decimal a readonly struct.
I'll add new tests to CoreFX also.
Contributes to https://github.com/dotnet/coreclr/issues/18249.
x64
x86
@jkotas I have a WIP readonly decimal branch, it doesn't compile yet because of
VarDecModandNumberBufferToDecimal, but can you check if I'm on the right track?