diff --git a/src/traits.rs b/src/traits.rs index afb763e1..f8b4d423 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -458,9 +458,12 @@ pub trait MulMod { } /// Compute `1 / self mod p`. -pub trait InvMod: Sized { +pub trait InvMod: Sized { + /// Output type. + type Output; + /// Compute `1 / self mod p`. - fn inv_mod(&self, p: &Self) -> CtOption; + fn inv_mod(&self, p: &Rhs) -> CtOption; } /// Checked addition. diff --git a/src/uint/boxed/inv_mod.rs b/src/uint/boxed/inv_mod.rs index 670978f5..1b33644f 100644 --- a/src/uint/boxed/inv_mod.rs +++ b/src/uint/boxed/inv_mod.rs @@ -80,6 +80,8 @@ impl BoxedUint { } impl InvMod for BoxedUint { + type Output = Self; + fn inv_mod(&self, modulus: &Self) -> CtOption { self.inv_mod(modulus) } diff --git a/src/uint/inv_mod.rs b/src/uint/inv_mod.rs index 02485829..36a17e11 100644 --- a/src/uint/inv_mod.rs +++ b/src/uint/inv_mod.rs @@ -137,6 +137,8 @@ impl InvMod for Uint where Odd: PrecomputeInverter>, { + type Output = Self; + fn inv_mod(&self, modulus: &Self) -> CtOption { self.inv_mod(modulus).into() }