Skip to content
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

Add BoxedUint::gcd #497

Merged
merged 1 commit into from
Dec 23, 2023
Merged

Add BoxedUint::gcd #497

merged 1 commit into from
Dec 23, 2023

Conversation

tarcieri
Copy link
Member

Support for computing the greatest common divisor of two BoxedUints using Bernstein-Yang

Support for computing the greatest common divisor of two `BoxedUint`s
using Bernstein-Yang
Comment on lines +6 to +11
impl Odd<BoxedUint> {
/// Compute the greatest common divisor (GCD) of this number and another.
pub fn gcd(&self, rhs: &BoxedUint) -> BoxedUint {
bernstein_yang::boxed::gcd(self, rhs)
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defining the method on Odd allows it to be infallible (since Bernstein-Yang requires self is odd), though perhaps there should be a more convenient way to call it and get a CtOption

@tarcieri tarcieri requested a review from fjarri December 23, 2023 00:31
@tarcieri tarcieri merged commit 25ec62a into master Dec 23, 2023
16 checks passed
@tarcieri tarcieri deleted the boxed-uint/gcd branch December 23, 2023 00:31
@tarcieri tarcieri mentioned this pull request Jan 22, 2025
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.

1 participant