Skip to content

[test/Prototypes] Fix DoubleWidth think-o that trips an assert #69442

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

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

xwu
Copy link
Collaborator

@xwu xwu commented Oct 26, 2023

If lhs and rhs have the same number of leading zero bits (and we know rhs < lhs), then we can't call _divide to divide a triple-width magnitude by a double-width magnitude (this trips the assert on line 598), but rather we know that the quotient is one. Additionally, we must use >> instead of &>> when computing the high word because in this scenario the leading zero bits may be zero.

Resolves apple/swift-numerics#272

@xwu xwu requested a review from stephentyrone October 26, 2023 20:30
@xwu xwu marked this pull request as ready for review October 26, 2023 20:38
@xwu
Copy link
Collaborator Author

xwu commented Oct 26, 2023

@swift-ci smoke test

@xwu
Copy link
Collaborator Author

xwu commented Oct 30, 2023

@swift-ci smoke test

@xwu xwu merged commit d1611f7 into swiftlang:main Oct 31, 2023
@xwu xwu deleted the double-double branch October 31, 2023 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash in DoubleWidth
2 participants