forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Span.CopyTo(Span) in BigInteger's add and subtract
In BigIntegerCalculator methods Add and Subtract, if sizes of arguments differ, after processing the part of size of the right (small) argument, there was loop of add/sub carry value. When the carry value once become zero, in fact the rest of the larger argument can be copied to the result. With this commit the second loop is interrupted when carry become zero and applies fast Span.CopyTo(Span) to the rest part. This optimization applied only when size of the greatest argument is more or equal to const CopyToThreshold introduced in this commit. This const is 8 now. Also made minor related changes to hot cycles. See dotnet#83457 for details.
- Loading branch information
Showing
1 changed file
with
163 additions
and
40 deletions.
There are no files selected for viewing
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