-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Rewrite BigInteger internals to use native-width (nuint) limbs #125799
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
Open
stephentoub
wants to merge
27
commits into
dotnet:main
Choose a base branch
from
stephentoub:biginteger-nuint-rewrite
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5,170
−3,161
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
3a85f20
Convert Number.BigInteger.cs from uint limbs to nuint limbs
stephentoub 95f6d3c
Convert BigInteger internal representation from uint to nuint limbs
stephentoub 7a8770c
Fix SubWithBorrow sign-extension bug on 32-bit and update stale comments
stephentoub 5255f85
Use branchless underflow detection in SubtractDivisor
stephentoub bf3328d
Fuse two's complement conversion with bitwise AND/OR/XOR
stephentoub 71968ac
Cache PowersOf1e9 table for repeated ToString/Parse calls
stephentoub 2fd9896
Tune Burnikel-Ziegler division threshold for 64-bit limbs
stephentoub 2109128
Add property-based validation tests and fix BitwiseAnd sign bug
stephentoub defa53d
Add edge-case tests for sign combos, SIMD boundaries, and coverage gaps
stephentoub 2b0b385
Add Montgomery multiplication for ModPow with odd moduli
stephentoub 3333cec
Add tests for Barrett+FastReducer with even large moduli
stephentoub 2c9b356
Add sliding window exponentiation and separate squaring thresholds
stephentoub 1323037
Avoid array copy in GCD when one operand is zero
stephentoub bf16170
Optimize GCD LehmerCore and DivRem to avoid Int128/UInt128 overhead
stephentoub 16024df
Fix ToString Naive loop regression by processing 32-bit halves
stephentoub c09c5ff
Fix small-operand, GCD LehmerCore, and ToByteArray regressions
stephentoub c3fc756
Add unrolled Mul1/MulAdd1/SubMul1 primitives for multiply and divisio…
stephentoub 52dc799
Replace Unsafe.Add with span indexing using bounds hints for JIT elision
stephentoub db7bb90
Use hardware intrinsics for BigMul, DivRem, and AddWithCarry primitives
stephentoub 2990b90
Revert _sign from nint to int to eliminate small-value regressions
stephentoub 60a0281
Use ulong arithmetic in PowCore when modulus fits in uint
stephentoub 3dbb09e
Clean up formatting / style
stephentoub d480a31
Fix SubtractSelf callers to restore borrow==0 postcondition
stephentoub 69bdfb5
Address PR feedback
stephentoub 3c7b88c
Address feedback
stephentoub 23ee9c7
Fix GetSignBitsIfValid XML doc to clarify 'valid hex digit and consid…
stephentoub 79c944d
Add comment explaining nuint[] for base-1e9 intermediate representation
stephentoub File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.