From e333a57a1952bca66e8063f80d3b6915b90db06b Mon Sep 17 00:00:00 2001 From: Mathijs van de Nes Date: Wed, 8 Jul 2015 15:02:18 +0200 Subject: [PATCH] Implement Div for Wrapping Resolves #26867 --- src/libcore/num/wrapping.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 748ed29e3a30..1636a1e2703f 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -119,6 +119,16 @@ macro_rules! wrapping_impl { } } + #[stable(feature = "rust1", since = "1.3.0")] + impl Div for Wrapping<$t> { + type Output = Wrapping<$t>; + + #[inline(always)] + fn div(self, other: Wrapping<$t>) -> Wrapping<$t> { + Wrapping(self.0 / other.0) + } + } + #[stable(feature = "rust1", since = "1.0.0")] impl Not for Wrapping<$t> { type Output = Wrapping<$t>;