From d1334bf9033bb7d0f0876a736d3aa9de2e68579a Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Mon, 9 Apr 2018 11:11:21 +0200 Subject: [PATCH] Added impls of `Signed` for `i128` and `u128` --- src/bounds.rs | 14 +++++++++++++- src/sign.rs | 3 +++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/bounds.rs b/src/bounds.rs index b4aa909..5ca818f 100644 --- a/src/bounds.rs +++ b/src/bounds.rs @@ -93,8 +93,20 @@ fn wrapping_bounded() { } test_wrapping_bounded!(usize u8 u16 u32 u64 isize i8 i16 i32 i64); +} + +#[cfg(feature = "i128")] +#[test] +fn wrapping_bounded_i128() { + macro_rules! test_wrapping_bounded { + ($($t:ty)+) => { + $( + assert_eq!(Wrapping::<$t>::min_value().0, <$t>::min_value()); + assert_eq!(Wrapping::<$t>::max_value().0, <$t>::max_value()); + )+ + }; + } - #[cfg(feature = "i128")] test_wrapping_bounded!(u128 i128); } diff --git a/src/sign.rs b/src/sign.rs index 932496a..71b11ee 100644 --- a/src/sign.rs +++ b/src/sign.rs @@ -74,6 +74,9 @@ macro_rules! signed_impl { signed_impl!(isize i8 i16 i32 i64); +#[cfg(feature = "i128")] +signed_impl!(i128); + impl Signed for Wrapping where Wrapping: Num + Neg> { #[inline]