Skip to content

Commit 4e253cd

Browse files
committed
Assume has_float_to_from_bytes
1 parent 7212041 commit 4e253cd

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,5 @@ fn main() {
33

44
ac.emit_expression_cfg("1f64.total_cmp(&2f64)", "has_total_cmp"); // 1.62
55

6-
ac.emit_expression_cfg("3.14f64.to_ne_bytes()", "has_float_to_from_bytes");
7-
86
autocfg::rerun_path("build.rs");
97
}

src/ops/bytes.rs

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ pub trait FromBytes: Sized {
150150

151151
macro_rules! float_to_from_bytes_impl {
152152
($T:ty, $L:expr) => {
153-
#[cfg(has_float_to_from_bytes)]
154153
impl ToBytes for $T {
155154
type Bytes = [u8; $L];
156155

@@ -170,7 +169,6 @@ macro_rules! float_to_from_bytes_impl {
170169
}
171170
}
172171

173-
#[cfg(has_float_to_from_bytes)]
174172
impl FromBytes for $T {
175173
type Bytes = [u8; $L];
176174

@@ -189,46 +187,6 @@ macro_rules! float_to_from_bytes_impl {
189187
<$T>::from_ne_bytes(*bytes)
190188
}
191189
}
192-
193-
#[cfg(not(has_float_to_from_bytes))]
194-
impl ToBytes for $T {
195-
type Bytes = [u8; $L];
196-
197-
#[inline]
198-
fn to_be_bytes(&self) -> Self::Bytes {
199-
ToBytes::to_be_bytes(&self.to_bits())
200-
}
201-
202-
#[inline]
203-
fn to_le_bytes(&self) -> Self::Bytes {
204-
ToBytes::to_le_bytes(&self.to_bits())
205-
}
206-
207-
#[inline]
208-
fn to_ne_bytes(&self) -> Self::Bytes {
209-
ToBytes::to_ne_bytes(&self.to_bits())
210-
}
211-
}
212-
213-
#[cfg(not(has_float_to_from_bytes))]
214-
impl FromBytes for $T {
215-
type Bytes = [u8; $L];
216-
217-
#[inline]
218-
fn from_be_bytes(bytes: &Self::Bytes) -> Self {
219-
Self::from_bits(FromBytes::from_be_bytes(bytes))
220-
}
221-
222-
#[inline]
223-
fn from_le_bytes(bytes: &Self::Bytes) -> Self {
224-
Self::from_bits(FromBytes::from_le_bytes(bytes))
225-
}
226-
227-
#[inline]
228-
fn from_ne_bytes(bytes: &Self::Bytes) -> Self {
229-
Self::from_bits(FromBytes::from_ne_bytes(bytes))
230-
}
231-
}
232190
};
233191
}
234192

0 commit comments

Comments
 (0)