| 
1 | 1 | //! [`BoxedUint`] division operations.  | 
2 | 2 | 
  | 
3 | 3 | use crate::{BoxedUint, Limb, NonZero};  | 
 | 4 | +use core::ops::{Rem, RemAssign};  | 
4 | 5 | use subtle::ConstantTimeEq;  | 
5 | 6 | 
 
  | 
6 | 7 | impl BoxedUint {  | 
@@ -31,6 +32,54 @@ impl BoxedUint {  | 
31 | 32 |     }  | 
32 | 33 | }  | 
33 | 34 | 
 
  | 
 | 35 | +impl Rem<&NonZero<BoxedUint>> for &BoxedUint {  | 
 | 36 | +    type Output = BoxedUint;  | 
 | 37 | + | 
 | 38 | +    #[inline]  | 
 | 39 | +    fn rem(self, rhs: &NonZero<BoxedUint>) -> Self::Output {  | 
 | 40 | +        self.rem_vartime(rhs)  | 
 | 41 | +    }  | 
 | 42 | +}  | 
 | 43 | + | 
 | 44 | +impl Rem<&NonZero<BoxedUint>> for BoxedUint {  | 
 | 45 | +    type Output = BoxedUint;  | 
 | 46 | + | 
 | 47 | +    #[inline]  | 
 | 48 | +    fn rem(self, rhs: &NonZero<BoxedUint>) -> Self::Output {  | 
 | 49 | +        self.rem_vartime(rhs)  | 
 | 50 | +    }  | 
 | 51 | +}  | 
 | 52 | + | 
 | 53 | +impl Rem<NonZero<BoxedUint>> for &BoxedUint {  | 
 | 54 | +    type Output = BoxedUint;  | 
 | 55 | + | 
 | 56 | +    #[inline]  | 
 | 57 | +    fn rem(self, rhs: NonZero<BoxedUint>) -> Self::Output {  | 
 | 58 | +        self.rem_vartime(&rhs)  | 
 | 59 | +    }  | 
 | 60 | +}  | 
 | 61 | + | 
 | 62 | +impl Rem<NonZero<BoxedUint>> for BoxedUint {  | 
 | 63 | +    type Output = BoxedUint;  | 
 | 64 | + | 
 | 65 | +    #[inline]  | 
 | 66 | +    fn rem(self, rhs: NonZero<BoxedUint>) -> Self::Output {  | 
 | 67 | +        self.rem_vartime(&rhs)  | 
 | 68 | +    }  | 
 | 69 | +}  | 
 | 70 | + | 
 | 71 | +impl RemAssign<&NonZero<BoxedUint>> for BoxedUint {  | 
 | 72 | +    fn rem_assign(&mut self, rhs: &NonZero<BoxedUint>) {  | 
 | 73 | +        *self = self.rem_vartime(&rhs)  | 
 | 74 | +    }  | 
 | 75 | +}  | 
 | 76 | + | 
 | 77 | +impl RemAssign<NonZero<BoxedUint>> for BoxedUint {  | 
 | 78 | +    fn rem_assign(&mut self, rhs: NonZero<BoxedUint>) {  | 
 | 79 | +        *self = self.rem_vartime(&rhs)  | 
 | 80 | +    }  | 
 | 81 | +}  | 
 | 82 | + | 
34 | 83 | #[cfg(test)]  | 
35 | 84 | mod tests {  | 
36 | 85 |     use super::{BoxedUint, NonZero};  | 
 | 
0 commit comments