-
Notifications
You must be signed in to change notification settings - Fork 57
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
Int
- inv_mod
#737
base: master
Are you sure you want to change the base?
Int
- inv_mod
#737
Conversation
pub trait InvMod: Sized { | ||
pub trait InvMod<Rhs = Self, Output = Self>: Sized { | ||
/// Compute `1 / self mod p`. | ||
fn inv_mod(&self, p: &Self) -> CtOption<Self>; | ||
fn inv_mod(&self, p: &Rhs) -> CtOption<Output>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tarcieri this is the non-breaking type approach for this trait. I think a more readable solution would be to add the type Modulus;
and type Output;
as trait types. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
making Output
an associated type makes sense, however Rhs
is typically a generic parameter in core arithmetic traits, which allows overlapping impls potentially (though I'm not sure that would be of use here)
Introduces the
Int::inv_mod
operation.Replaces #727