diff --git a/src/fmt/num.rs b/src/fmt/num.rs index 4451ab4..86f0be7 100644 --- a/src/fmt/num.rs +++ b/src/fmt/num.rs @@ -29,7 +29,6 @@ trait Int: PartialEq + PartialOrd + Div + Rem + fn to_u16(&self) -> u16; fn to_u32(&self) -> u32; fn to_u64(&self) -> u64; - fn to_u128(&self) -> u128; } macro_rules! doit { @@ -40,10 +39,9 @@ macro_rules! doit { fn to_u16(&self) -> u16 { *self as u16 } fn to_u32(&self) -> u32 { *self as u32 } fn to_u64(&self) -> u64 { *self as u64 } - fn to_u128(&self) -> u128 { *self as u128 } })*) } -doit! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize } +doit! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } /// A type that represents a specific radix #[doc(hidden)] @@ -184,7 +182,6 @@ integer! { i8, u8 } integer! { i16, u16 } integer! { i32, u32 } integer! { i64, u64 } -integer! { i128, u128 } const DEC_DIGITS_LUT: &'static[u8] = b"0001020304050607080910111213141516171819\ @@ -260,7 +257,6 @@ macro_rules! impl_Display { impl_Display!(i8, u8, i16, u16, i32, u32: to_u32); impl_Display!(i64, u64: to_u64); -impl_Display!(i128, u128: to_u128); #[cfg(target_pointer_width = "16")] impl_Display!(isize, usize: to_u16); #[cfg(target_pointer_width = "32")] diff --git a/src/iter/range.rs b/src/iter/range.rs index 5896322..04c141a 100644 --- a/src/iter/range.rs +++ b/src/iter/range.rs @@ -175,7 +175,6 @@ step_impl_signed!([i64: u64]); // assume here that it is less than 64-bits. #[cfg(not(target_pointer_width = "64"))] step_impl_no_between!(u64 i64); -step_impl_no_between!(u128 i128); macro_rules! range_exact_iter_impl { ($($t:ty)*) => ($( diff --git a/src/iter/traits.rs b/src/iter/traits.rs index ddbb599..627b867 100644 --- a/src/iter/traits.rs +++ b/src/iter/traits.rs @@ -833,7 +833,7 @@ macro_rules! float_sum_product { )*) } -integer_sum_product! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize } +integer_sum_product! { i8 i16 i32 i64 isize u8 u16 u32 u64 usize } float_sum_product! { f32 f64 } /// An iterator adapter that produces output as long as the underlying diff --git a/src/lib.rs b/src/lib.rs index f8a3f54..2776331 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -138,15 +138,12 @@ mod uint_macros; #[path = "num/i16.rs"] pub mod i16; #[path = "num/i32.rs"] pub mod i32; #[path = "num/i64.rs"] pub mod i64; -#[path = "num/i128.rs"] pub mod i128; #[path = "num/usize.rs"] pub mod usize; #[path = "num/u8.rs"] pub mod u8; #[path = "num/u16.rs"] pub mod u16; #[path = "num/u32.rs"] pub mod u32; #[path = "num/u64.rs"] pub mod u64; -#[path = "num/u128.rs"] pub mod u128; - #[macro_use] pub mod num; diff --git a/src/num/mod.rs b/src/num/mod.rs index a062fbd..64f9f05 100644 --- a/src/num/mod.rs +++ b/src/num/mod.rs @@ -101,7 +101,6 @@ nonzero_integers! { NonZeroU16(u16); NonZeroU32(u32); NonZeroU64(u64); - NonZeroU128(u128); NonZeroUsize(usize); } @@ -114,7 +113,6 @@ nonzero_integers! { NonZeroI16(i16); NonZeroI32(i32); NonZeroI64(i64); - NonZeroI128(i128); NonZeroIsize(isize); } @@ -1940,12 +1938,6 @@ impl i64 { int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" } } -#[lang = "i128"] -impl i128 { - int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728, - 170141183460469231731687303715884105727, "", "" } -} - #[cfg(target_pointer_width = "16")] #[lang = "isize"] impl isize { @@ -4030,11 +4022,6 @@ impl u64 { uint_impl! { u64, u64, 64, 18446744073709551615, "", "" } } -#[lang = "u128"] -impl u128 { - uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "" } -} - #[cfg(target_pointer_width = "16")] #[lang = "usize"] impl usize { @@ -4168,7 +4155,7 @@ macro_rules! from_str_radix_int_impl { } )*} } -from_str_radix_int_impl! { isize i8 i16 i32 i64 i128 usize u8 u16 u32 u64 u128 } +from_str_radix_int_impl! { isize i8 i16 i32 i64 usize u8 u16 u32 u64 } /// The error type returned when a checked integral type conversion fails. #[unstable(feature = "try_from", issue = "33417")] @@ -4269,30 +4256,25 @@ macro_rules! rev { try_from_upper_bounded!(u16, u8); try_from_upper_bounded!(u32, u16, u8); try_from_upper_bounded!(u64, u32, u16, u8); -try_from_upper_bounded!(u128, u64, u32, u16, u8); try_from_both_bounded!(i16, i8); try_from_both_bounded!(i32, i16, i8); try_from_both_bounded!(i64, i32, i16, i8); -try_from_both_bounded!(i128, i64, i32, i16, i8); // unsigned-to-signed try_from_upper_bounded!(u8, i8); try_from_upper_bounded!(u16, i8, i16); try_from_upper_bounded!(u32, i8, i16, i32); try_from_upper_bounded!(u64, i8, i16, i32, i64); -try_from_upper_bounded!(u128, i8, i16, i32, i64, i128); // signed-to-unsigned -try_from_lower_bounded!(i8, u8, u16, u32, u64, u128); -try_from_lower_bounded!(i16, u16, u32, u64, u128); -try_from_lower_bounded!(i32, u32, u64, u128); -try_from_lower_bounded!(i64, u64, u128); -try_from_lower_bounded!(i128, u128); +try_from_lower_bounded!(i8, u8, u16, u32, u64); +try_from_lower_bounded!(i16, u16, u32, u64); +try_from_lower_bounded!(i32, u32, u64); +try_from_lower_bounded!(i64, u64); try_from_both_bounded!(i16, u8); try_from_both_bounded!(i32, u16, u8); try_from_both_bounded!(i64, u32, u16, u8); -try_from_both_bounded!(i128, u64, u32, u16, u8); // usize/isize try_from_upper_bounded!(usize, isize); @@ -4309,9 +4291,9 @@ mod ptr_try_from_impls { use convert::TryFrom; // Fallible across platfoms, only implementation differs - try_from_lower_bounded!(isize, u16, u32, u64, u128); + try_from_lower_bounded!(isize, u16, u32, u64); rev!(try_from_lower_bounded, usize, i8, i16); - rev!(try_from_both_bounded, usize, i32, i64, i128); + rev!(try_from_both_bounded, usize, i32, i64); } #[cfg(target_pointer_width = "32")] @@ -4321,9 +4303,9 @@ mod ptr_try_from_impls { // Fallible across platfoms, only implementation differs try_from_both_bounded!(isize, u16); - try_from_lower_bounded!(isize, u32, u64, u128); + try_from_lower_bounded!(isize, u32, u64); rev!(try_from_lower_bounded, usize, i8, i16, i32); - rev!(try_from_both_bounded, usize, i64, i128); + rev!(try_from_both_bounded, usize, i64); } #[cfg(target_pointer_width = "64")] @@ -4333,9 +4315,8 @@ mod ptr_try_from_impls { // Fallible across platfoms, only implementation differs try_from_both_bounded!(isize, u16, u32); - try_from_lower_bounded!(isize, u64, u128); + try_from_lower_bounded!(isize, u64); rev!(try_from_lower_bounded, usize, i8, i16, i32, i64); - rev!(try_from_both_bounded, usize, i128); } #[doc(hidden)] @@ -4370,7 +4351,7 @@ macro_rules! doit { } })*) } -doit! { i8 i16 i32 i64 i128 isize u8 u16 u32 u64 u128 usize } +doit! { i8 i16 i32 isize u8 u16 u32 usize } fn from_str_radix(src: &str, radix: u32) -> Result { use self::IntErrorKind::*; @@ -4511,39 +4492,27 @@ macro_rules! impl_from { impl_from! { u8, u16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u8, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u8, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u8, u128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { u8, usize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u16, u32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u16, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u16, u128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { u32, u64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u32, u128, #[stable(feature = "i128", since = "1.26.0")] } -impl_from! { u64, u128, #[stable(feature = "i128", since = "1.26.0")] } // Signed -> Signed impl_from! { i8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { i8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { i8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { i8, i128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { i8, isize, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { i16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { i16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { i16, i128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { i32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { i32, i128, #[stable(feature = "i128", since = "1.26.0")] } -impl_from! { i64, i128, #[stable(feature = "i128", since = "1.26.0")] } // Unsigned -> Signed impl_from! { u8, i16, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u8, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u8, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u8, i128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { u16, i32, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } impl_from! { u16, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u16, i128, #[stable(feature = "i128", since = "1.26.0")] } impl_from! { u32, i64, #[stable(feature = "lossless_int_conv", since = "1.5.0")] } -impl_from! { u32, i128, #[stable(feature = "i128", since = "1.26.0")] } -impl_from! { u64, i128, #[stable(feature = "i128", since = "1.26.0")] } // The C99 standard defines bounds on INTPTR_MIN, INTPTR_MAX, and UINTPTR_MAX // which imply that pointer-sized integers must be at least 16 bits: @@ -4558,7 +4527,6 @@ impl_from! { i16, isize, #[stable(feature = "lossless_iusize_conv", since = "1.2 // https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/20171017a-cheri-poster.pdf // http://www.csl.sri.com/users/neumann/2012resolve-cheri.pdf - // Note: integers can only be represented with full precision in a float if // they fit in the significand, which is 24 bits in f32 and 53 bits in f64. // Lossy float conversions are not implemented at this time. diff --git a/src/num/wrapping.rs b/src/num/wrapping.rs index 826883f..0f91899 100644 --- a/src/num/wrapping.rs +++ b/src/num/wrapping.rs @@ -321,7 +321,7 @@ macro_rules! wrapping_impl { )*) } -wrapping_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } +wrapping_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 } macro_rules! wrapping_int_impl { ($($t:ty)*) => ($( @@ -628,7 +628,7 @@ macro_rules! wrapping_int_impl { )*) } -wrapping_int_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } +wrapping_int_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 } mod shift_max {