Avoid floating-point types in Ieee32::new and Ieee64::new. (#130)

* Avoid floating-point types in Ieee32::new and Ieee64::new.

This eliminates the need for unsafe code in code that uses Cretonne, a few
instances of unsafe code in Cretonne itself, and eliminates the only instance
of floating point in Cretonne.

* Rename new to with_bits, and new_from_float to with_float.
This commit is contained in:
Dan Gohman
2017-08-02 11:05:49 -07:00
committed by GitHub
parent 6dc5b3e608
commit 39488630f6
2 changed files with 52 additions and 35 deletions

View File

@@ -490,9 +490,9 @@ impl<Variable> SSABuilder<Variable>
let val = if ty.is_int() {
dfg.ins(&mut cur).iconst(ty, 0)
} else if ty == F32 {
dfg.ins(&mut cur).f32const(Ieee32::new(0.0))
dfg.ins(&mut cur).f32const(Ieee32::with_bits(0))
} else if ty == F64 {
dfg.ins(&mut cur).f64const(Ieee64::new(0.0))
dfg.ins(&mut cur).f64const(Ieee64::with_bits(0))
} else {
panic!("value used but never declared and initialization not supported")
};