[vcpkg] Correct UInt128 code 😇#10583
Merged
strega-nil merged 4 commits intomicrosoft:masterfrom Apr 9, 2020
Merged
Conversation
`UInt128::operator<<(x, y)` should clear the bottom 64 bits of `x` if `y >= 64`; however, we don't do this, and so we duplicate `x`'s bottom bits into `x.top` instead of moving them. Similarly, we have the opposite problem for `UInt128::operator>>`. This commit fixes these latent bugs, which we weren't hitting because the thing we use them for never actually shifts more than 64 bits.
RobertHenry6bev
suggested changes
Mar 27, 2020
RobertHenry6bev
left a comment
There was a problem hiding this comment.
I would write some unit tests too.
Contributor
|
/azp run |
1 similar comment
Contributor
Author
|
/azp run |
Contributor
Author
|
Oof, getting 504s from github when trying to download the code... |
BillyONeal
approved these changes
Apr 9, 2020
strega-nil
added a commit
to strega-nil/vcpkg
that referenced
this pull request
May 5, 2021
* [vcpkg] Correct UInt128 code 😇 `UInt128::operator<<(x, y)` should clear the bottom 64 bits of `x` if `y >= 64`; however, we don't do this, and so we duplicate `x`'s bottom bits into `x.top` instead of moving them. Similarly, we have the opposite problem for `UInt128::operator>>`. This commit fixes these latent bugs, which we weren't hitting because the thing we use them for never actually shifts more than 64 bits.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
UInt128::operator<<(x, y)should clear the bottom 64 bits ofxify >= 64; however, we don't do this, and so we duplicatex's bottombits into
x.topinstead of moving them. Similarly, we have theopposite problem for
UInt128::operator>>. This commit fixes theselatent bugs, which we weren't hitting because the thing we use them for
never actually shifts more than 64 bits.
Fixes #10582 :)