diff --git a/build.rs b/build.rs index 4d0ae26..32f5f92 100644 --- a/build.rs +++ b/build.rs @@ -3,7 +3,6 @@ fn main() { ac.emit_expression_cfg("1f64.total_cmp(&2f64)", "has_total_cmp"); // 1.62 - ac.emit_expression_cfg("1u32.to_ne_bytes()", "has_int_to_from_bytes"); ac.emit_expression_cfg("3.14f64.to_ne_bytes()", "has_float_to_from_bytes"); autocfg::rerun_path("build.rs"); diff --git a/src/ops/bytes.rs b/src/ops/bytes.rs index 4df9ecd..1351aa6 100644 --- a/src/ops/bytes.rs +++ b/src/ops/bytes.rs @@ -2,8 +2,6 @@ use core::borrow::{Borrow, BorrowMut}; use core::cmp::{Eq, Ord, PartialEq, PartialOrd}; use core::fmt::Debug; use core::hash::Hash; -#[cfg(not(has_int_to_from_bytes))] -use core::mem::transmute; pub trait NumBytes: Debug @@ -236,7 +234,6 @@ macro_rules! float_to_from_bytes_impl { macro_rules! int_to_from_bytes_impl { ($T:ty, $L:expr) => { - #[cfg(has_int_to_from_bytes)] impl ToBytes for $T { type Bytes = [u8; $L]; @@ -256,7 +253,6 @@ macro_rules! int_to_from_bytes_impl { } } - #[cfg(has_int_to_from_bytes)] impl FromBytes for $T { type Bytes = [u8; $L]; @@ -275,46 +271,6 @@ macro_rules! int_to_from_bytes_impl { <$T>::from_ne_bytes(*bytes) } } - - #[cfg(not(has_int_to_from_bytes))] - impl ToBytes for $T { - type Bytes = [u8; $L]; - - #[inline] - fn to_be_bytes(&self) -> Self::Bytes { - <$T as ToBytes>::to_ne_bytes(&<$T>::to_be(*self)) - } - - #[inline] - fn to_le_bytes(&self) -> Self::Bytes { - <$T as ToBytes>::to_ne_bytes(&<$T>::to_le(*self)) - } - - #[inline] - fn to_ne_bytes(&self) -> Self::Bytes { - unsafe { transmute(*self) } - } - } - - #[cfg(not(has_int_to_from_bytes))] - impl FromBytes for $T { - type Bytes = [u8; $L]; - - #[inline] - fn from_be_bytes(bytes: &Self::Bytes) -> Self { - Self::from_be(::from_ne_bytes(bytes)) - } - - #[inline] - fn from_le_bytes(bytes: &Self::Bytes) -> Self { - Self::from_le(::from_ne_bytes(bytes)) - } - - #[inline] - fn from_ne_bytes(bytes: &Self::Bytes) -> Self { - unsafe { transmute(*bytes) } - } - } }; }