From 26accbadf8218a8ffde222ffa7673d15fa981e55 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Thu, 19 Sep 2019 12:24:39 +0200 Subject: [PATCH] Use f32::to_bits and f64::to_bits --- cranelift/codegen/src/ir/immediates.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cranelift/codegen/src/ir/immediates.rs b/cranelift/codegen/src/ir/immediates.rs index 371c05bdd9..c46b5ac0d3 100644 --- a/cranelift/codegen/src/ir/immediates.rs +++ b/cranelift/codegen/src/ir/immediates.rs @@ -809,7 +809,7 @@ impl Ieee32 { /// Create a new `Ieee32` representing the number `x`. pub fn with_float(x: f32) -> Self { - Ieee32(unsafe { mem::transmute(x) }) + Ieee32(x.to_bits()) } /// Get the bitwise representation. @@ -882,7 +882,7 @@ impl Ieee64 { /// Create a new `Ieee64` representing the number `x`. pub fn with_float(x: f64) -> Self { - Ieee64(unsafe { mem::transmute(x) }) + Ieee64(x.to_bits()) } /// Get the bitwise representation.