Skip to content

Commit

Permalink
Use f{32,64}::from_bits
Browse files Browse the repository at this point in the history
  • Loading branch information
Xanewok committed Jun 25, 2019
1 parent 303f77e commit dedcd97
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/libserialize/opaque.rs
Expand Up @@ -296,13 +296,13 @@ impl<'a> serialize::Decoder for Decoder<'a> {
#[inline]
fn read_f64(&mut self) -> Result<f64, Self::Error> {
let bits = self.read_u64()?;
Ok(unsafe { ::std::mem::transmute(bits) })
Ok(f64::from_bits(bits))
}

#[inline]
fn read_f32(&mut self) -> Result<f32, Self::Error> {
let bits = self.read_u32()?;
Ok(unsafe { ::std::mem::transmute(bits) })
Ok(f32::from_bits(bits))
}

#[inline]
Expand Down

0 comments on commit dedcd97

Please sign in to comment.