1111use llvm:: { self , ValueRef } ;
1212use rustc:: middle:: const_val:: { ConstEvalErr , ConstVal , ErrKind } ;
1313use rustc_const_math:: ConstInt :: * ;
14- use rustc_const_math:: ConstFloat ;
1514use rustc_const_math:: { ConstInt , ConstMathErr } ;
1615use rustc:: hir:: def_id:: DefId ;
1716use rustc:: infer:: TransNormalize ;
@@ -27,7 +26,7 @@ use abi::{self, Abi};
2726use callee;
2827use builder:: Builder ;
2928use common:: { self , CrateContext , const_get_elt, val_ty} ;
30- use common:: { C_array , C_bool , C_bytes , C_floating_f64 , C_integral , C_big_integral } ;
29+ use common:: { C_array , C_bool , C_bytes , C_integral , C_big_integral , C_u32 , C_u64 } ;
3130use common:: { C_null , C_struct , C_str_slice , C_undef , C_uint , C_vector , is_undef} ;
3231use common:: const_to_opt_u128;
3332use consts;
@@ -37,6 +36,7 @@ use type_::Type;
3736use value:: Value ;
3837
3938use syntax_pos:: Span ;
39+ use syntax:: ast;
4040
4141use std:: fmt;
4242use std:: ptr;
@@ -96,11 +96,11 @@ impl<'tcx> Const<'tcx> {
9696 let llty = type_of:: type_of ( ccx, ty) ;
9797 let val = match cv {
9898 ConstVal :: Float ( v) => {
99- let v_f64 = match v {
100- ConstFloat :: F32 ( v ) => f32 :: from_bits ( v ) as f64 ,
101- ConstFloat :: F64 ( v ) => f64 :: from_bits ( v )
99+ let bits = match v. ty {
100+ ast :: FloatTy :: F32 => C_u32 ( ccx , v . bits as u32 ) ,
101+ ast :: FloatTy :: F64 => C_u64 ( ccx , v . bits as u64 )
102102 } ;
103- C_floating_f64 ( v_f64 , llty)
103+ consts :: bitcast ( bits , llty)
104104 }
105105 ConstVal :: Bool ( v) => C_bool ( ccx, v) ,
106106 ConstVal :: Integral ( ref i) => return Const :: from_constint ( ccx, i) ,
0 commit comments