From 5ee2570618e29acb796d8ddf58b60590a154e2e1 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Mon, 9 Apr 2018 11:11:05 +0200 Subject: [PATCH] =?UTF-8?q?Added=20impls=20of=20`Wrapping=E2=80=A6`=20for?= =?UTF-8?q?=20`i128`=20and=20`u128`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ops/wrapping.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ops/wrapping.rs b/src/ops/wrapping.rs index 24f3405..fc44678 100644 --- a/src/ops/wrapping.rs +++ b/src/ops/wrapping.rs @@ -32,12 +32,16 @@ wrapping_impl!(WrappingAdd, wrapping_add, u16); wrapping_impl!(WrappingAdd, wrapping_add, u32); wrapping_impl!(WrappingAdd, wrapping_add, u64); wrapping_impl!(WrappingAdd, wrapping_add, usize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingAdd, wrapping_add, u128); wrapping_impl!(WrappingAdd, wrapping_add, i8); wrapping_impl!(WrappingAdd, wrapping_add, i16); wrapping_impl!(WrappingAdd, wrapping_add, i32); wrapping_impl!(WrappingAdd, wrapping_add, i64); wrapping_impl!(WrappingAdd, wrapping_add, isize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingAdd, wrapping_add, i128); /// Performs subtraction that wraps around on overflow. pub trait WrappingSub: Sized + Sub { @@ -51,12 +55,16 @@ wrapping_impl!(WrappingSub, wrapping_sub, u16); wrapping_impl!(WrappingSub, wrapping_sub, u32); wrapping_impl!(WrappingSub, wrapping_sub, u64); wrapping_impl!(WrappingSub, wrapping_sub, usize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingSub, wrapping_sub, u128); wrapping_impl!(WrappingSub, wrapping_sub, i8); wrapping_impl!(WrappingSub, wrapping_sub, i16); wrapping_impl!(WrappingSub, wrapping_sub, i32); wrapping_impl!(WrappingSub, wrapping_sub, i64); wrapping_impl!(WrappingSub, wrapping_sub, isize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingSub, wrapping_sub, i128); /// Performs multiplication that wraps around on overflow. pub trait WrappingMul: Sized + Mul { @@ -70,12 +78,16 @@ wrapping_impl!(WrappingMul, wrapping_mul, u16); wrapping_impl!(WrappingMul, wrapping_mul, u32); wrapping_impl!(WrappingMul, wrapping_mul, u64); wrapping_impl!(WrappingMul, wrapping_mul, usize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingMul, wrapping_mul, u128); wrapping_impl!(WrappingMul, wrapping_mul, i8); wrapping_impl!(WrappingMul, wrapping_mul, i16); wrapping_impl!(WrappingMul, wrapping_mul, i32); wrapping_impl!(WrappingMul, wrapping_mul, i64); wrapping_impl!(WrappingMul, wrapping_mul, isize); +#[cfg(feature = "i128")] +wrapping_impl!(WrappingMul, wrapping_mul, i128); // Well this is a bit funny, but all the more appropriate. impl WrappingAdd for Wrapping where Wrapping: Add> {