impl 128-bit CheckedRem and CheckedNeg

This commit is contained in:
Josh Stone 2018-05-07 12:28:15 -07:00
parent 428e0107d2
commit fe53805550
1 changed files with 8 additions and 0 deletions

View File

@ -136,12 +136,16 @@ checked_impl!(CheckedRem, checked_rem, u16);
checked_impl!(CheckedRem, checked_rem, u32); checked_impl!(CheckedRem, checked_rem, u32);
checked_impl!(CheckedRem, checked_rem, u64); checked_impl!(CheckedRem, checked_rem, u64);
checked_impl!(CheckedRem, checked_rem, usize); checked_impl!(CheckedRem, checked_rem, usize);
#[cfg(feature = "i128")]
checked_impl!(CheckedRem, checked_rem, u128);
checked_impl!(CheckedRem, checked_rem, i8); checked_impl!(CheckedRem, checked_rem, i8);
checked_impl!(CheckedRem, checked_rem, i16); checked_impl!(CheckedRem, checked_rem, i16);
checked_impl!(CheckedRem, checked_rem, i32); checked_impl!(CheckedRem, checked_rem, i32);
checked_impl!(CheckedRem, checked_rem, i64); checked_impl!(CheckedRem, checked_rem, i64);
checked_impl!(CheckedRem, checked_rem, isize); checked_impl!(CheckedRem, checked_rem, isize);
#[cfg(feature = "i128")]
checked_impl!(CheckedRem, checked_rem, i128);
macro_rules! checked_impl_unary { macro_rules! checked_impl_unary {
($trait_name:ident, $method:ident, $t:ty) => { ($trait_name:ident, $method:ident, $t:ty) => {
@ -180,12 +184,16 @@ checked_impl_unary!(CheckedNeg, checked_neg, u16);
checked_impl_unary!(CheckedNeg, checked_neg, u32); checked_impl_unary!(CheckedNeg, checked_neg, u32);
checked_impl_unary!(CheckedNeg, checked_neg, u64); checked_impl_unary!(CheckedNeg, checked_neg, u64);
checked_impl_unary!(CheckedNeg, checked_neg, usize); checked_impl_unary!(CheckedNeg, checked_neg, usize);
#[cfg(feature = "i128")]
checked_impl_unary!(CheckedNeg, checked_neg, u128);
checked_impl_unary!(CheckedNeg, checked_neg, i8); checked_impl_unary!(CheckedNeg, checked_neg, i8);
checked_impl_unary!(CheckedNeg, checked_neg, i16); checked_impl_unary!(CheckedNeg, checked_neg, i16);
checked_impl_unary!(CheckedNeg, checked_neg, i32); checked_impl_unary!(CheckedNeg, checked_neg, i32);
checked_impl_unary!(CheckedNeg, checked_neg, i64); checked_impl_unary!(CheckedNeg, checked_neg, i64);
checked_impl_unary!(CheckedNeg, checked_neg, isize); checked_impl_unary!(CheckedNeg, checked_neg, isize);
#[cfg(feature = "i128")]
checked_impl_unary!(CheckedNeg, checked_neg, i128);
/// Performs a left shift that returns `None` on overflow. /// Performs a left shift that returns `None` on overflow.
pub trait CheckedShl: Sized + Shl<u32, Output=Self> { pub trait CheckedShl: Sized + Shl<u32, Output=Self> {