Skip to content

Commit

Permalink
Don't reimplement to_bits and from_bits for floats
Browse files Browse the repository at this point in the history
They are provided by `core` since Rust 1.20.
  • Loading branch information
vks committed Jul 23, 2019
1 parent 1510b6c commit cf1b67c
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions src/distributions/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,9 @@ pub(crate) trait FloatSIMDUtils {
/// Implement functions available in std builds but missing from core primitives
#[cfg(not(std))]
pub(crate) trait Float : Sized {
type Bits;

fn is_nan(self) -> bool;
fn is_infinite(self) -> bool;
fn is_finite(self) -> bool;
fn to_bits(self) -> Self::Bits;
fn from_bits(v: Self::Bits) -> Self;
}

/// Implement functions on f32/f64 to give them APIs similar to SIMD types
Expand Down Expand Up @@ -289,8 +285,6 @@ macro_rules! scalar_float_impl {
($ty:ident, $uty:ident) => {
#[cfg(not(std))]
impl Float for $ty {
type Bits = $uty;

#[inline]
fn is_nan(self) -> bool {
self != self
Expand All @@ -305,17 +299,6 @@ macro_rules! scalar_float_impl {
fn is_finite(self) -> bool {
!(self.is_nan() || self.is_infinite())
}

#[inline]
fn to_bits(self) -> Self::Bits {
self.to_bits()
}

#[inline]
fn from_bits(v: Self::Bits) -> Self {
// It turns out the safety issues with sNaN were overblown! Hooray!
Self::from_bits(v)
}
}

impl FloatSIMDUtils for $ty {
Expand Down

0 comments on commit cf1b67c

Please sign in to comment.