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.
Spannified internals of BigInteger (dotnet#35565)
* Unsafe pointers replaced with managed pointers * Duplicate code replaced with static local * Spannified internals * Spannified compare * Spannified div/rem operations * Minus two array allocations for each bitwise operation * Removed redundant locals * Code review feedback (code style) * Code review feedback * LeadingZeroes replaced with BitOperations * stackalloc in Divide without remainder * Reduced memory allocation for bitwise operations * Managed pointer replaced with Span * Removed namespace imports * Removed delegate type * Reduced memory allocation in the end of each bitwise operation * Code review feedback * Removed redundant array allocation * Trivial division moved to stack alloc * Reduced memory allocation for divide operator * Reduced memory allocation for shift operations * Array pooling for Square operation * Fixed bound check for bitwise operations * Multiply now uses array pooling * Removed namespace import * Reduced memory allocation for Add * Removed swap of arguments * Reduced memory allocations for multiply operator * Reduced memory allocations for modulo operator * Temporarily spannify ActualLength method * Spannify FastReducer * Spannify initial parts of GCD alg * Simple GCD test for debugging * Simple test for debugging * Removed debug code * Spannified GCD algorithm * Removed arg passing by ref * Complete migration of gcd to span * Removed memory allocation for trivial case of GCD * Reorganize utility code * Removed redundant parameter * Reduced memory alloc for trivial case of Pow alg * Use span for trivial modulus pow case * Use span for trivial cases of pow modulus * Fixed buffer cleanup * Reduced memory allocation of ModPow operations * BitsBuffer replaced with span * Reorganize utility methods * Reduced visibility scope * Removed temporary code for bits cleanup * Fill leading bits with zeroes * Unify order of parameters * Unify order of parameters * Unify order of parameters * Reuse the same local var * Removed whtespace * Code review feedback * Avoid misleading with Span.CopyTo * Clarify purpose of slicing Co-authored-by: Günther Foidl <[email protected]> * Replace mentioning of uint[] in comments * Fixed code formatting issues * Share StackAllocThreshold const * Ignore const threshold values in Release config * Literal field cannot be discovered with TypeInfo.GetDeclaredField * Removed invalid assertion * Removed invalid assertion * Removed invalid assertion * Code review feedback * Fixed header * Fixed overflow of result buffer * Reduced ctor visibility * Eliminated bounds check * Returned optimization using Math.DivRem * Added braces to be consistent with other branches * Fixed location of the comment * Combine slice and conversion as the single line * Combine slice and conversion as the single line * Merge with parsing optimizations * Reduced checks * Removed redundant global const * Replaced magic consts with their named equivalents * Removed useless asserts * Manual merge with dotnet#53984 PR * Review feedback (use const for stackalloc) * Review feedback * Unsafe code replaced with span indexer where possible * Removed unused local * Review feedback Co-authored-by: Günther Foidl <[email protected]>
- Loading branch information
Showing
15 changed files
with
1,374 additions
and
1,409 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
871 changes: 573 additions & 298 deletions
871
src/libraries/System.Runtime.Numerics/src/System/Numerics/BigInteger.cs
Large diffs are not rendered by default.
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
Oops, something went wrong.