Skip to content

Conversation

kzrnm
Copy link
Contributor

@kzrnm kzrnm commented Feb 24, 2025

Fix #112564
Related #112878

Using BigInteger.GetPartsForBitManipulation will result in incorrect two's complement calculations for negative numbers where the most significant bit is set. For correct unsigned right shift, this method should not be used.

@tannergooding tannergooding merged commit 3e38bd8 into dotnet:main Feb 27, 2025
80 of 83 checks passed
@kzrnm kzrnm deleted the BigIntegerGetPartsForBitManipulation branch February 27, 2025 16:09
tannergooding pushed a commit that referenced this pull request Feb 27, 2025
* Add tests for the shift operator of BigInteger

* Fix the unsigned right shift operator of BigInteger

* avoid stackalloc

* external sign element
tannergooding pushed a commit that referenced this pull request Feb 27, 2025
* Add tests for the shift operator of BigInteger

* Fix the unsigned right shift operator of BigInteger

* avoid stackalloc

* external sign element
tannergooding pushed a commit that referenced this pull request Feb 27, 2025
* Add tests for the shift operator of BigInteger

* Fix the unsigned right shift operator of BigInteger

* avoid stackalloc

* external sign element
tannergooding pushed a commit that referenced this pull request Feb 27, 2025
* Add tests for the shift operator of BigInteger

* Fix the unsigned right shift operator of BigInteger

* avoid stackalloc

* external sign element
jeffhandley pushed a commit that referenced this pull request Mar 10, 2025
* Add BigInteger.Rotate* tests

* Fix BigInteger.Rotate*

* avoid stackalloc

* Add comment

* Fix the unsigned right shift operator of BigInteger (#112879)

* Add tests for the shift operator of BigInteger

* Fix the unsigned right shift operator of BigInteger

* avoid stackalloc

* external sign element

---------

Co-authored-by: kzrnm <[email protected]>
@github-actions github-actions bot locked and limited conversation to collaborators Mar 30, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Numerics community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The unsigned right shift operator (>>>) of BigInteger behaves strangely

2 participants