@@ -26,5 +26,98 @@ Function: float_bvt::convert
26
26
27
27
exprt float_bvt::convert (const exprt &src)
28
28
{
29
+ if (src.id ()==ID_abs)
30
+ return convert_abs (to_abs_expr (src));
31
+ else if (src.id ()==ID_unary_minus)
32
+ return convert_unary_minus (to_unary_minus_expr (src));
33
+ // else if(src.id()==ID_ieee_float_equal)
34
+ // return convert_ieee_float_equal(to_ieee_float_equal_expr(src));
35
+
29
36
return nil_exprt ();
30
37
}
38
+
39
+ /* ******************************************************************\
40
+
41
+ Function: float_bvt::convert_abs
42
+
43
+ Inputs:
44
+
45
+ Outputs:
46
+
47
+ Purpose:
48
+
49
+ \*******************************************************************/
50
+
51
+ exprt float_bvt::convert_abs (const abs_exprt &src)
52
+ {
53
+ // we mask away the sign bit, which is the most significand bit
54
+ const floatbv_typet &type=to_floatbv_type (src.type ());
55
+ unsigned width=type.get_width ();
56
+
57
+ std::string mask_str;
58
+ mask_str.resize (width, ' 1' );
59
+ mask_str[0 ]=' 0' ;
60
+
61
+ constant_exprt mask (mask_str, src.type ());
62
+
63
+ // return bitand_exprt(src.op(), mask);
64
+ }
65
+
66
+ /* ******************************************************************\
67
+
68
+ Function: float_bvt::convert_unary_minus
69
+
70
+ Inputs:
71
+
72
+ Outputs:
73
+
74
+ Purpose:
75
+
76
+ \*******************************************************************/
77
+
78
+ exprt float_bvt::convert_unary_minus (const unary_minus_exprt &src)
79
+ {
80
+ // we flip the sign bit with an xor
81
+ const floatbv_typet &type=to_floatbv_type (src.type ());
82
+ unsigned width=type.get_width ();
83
+
84
+ std::string mask_str;
85
+ mask_str.resize (width, ' 0' );
86
+ mask_str[0 ]=' 1' ;
87
+
88
+ constant_exprt mask (mask_str, src.type ());
89
+
90
+ // return bitxor_exprt(src.op(), mask);
91
+ }
92
+
93
+ /* ******************************************************************\
94
+
95
+ Function: float_bvt::convert_ieee_float_equal
96
+
97
+ Inputs:
98
+
99
+ Outputs:
100
+
101
+ Purpose:
102
+
103
+ \*******************************************************************/
104
+
105
+ exprt float_bvt::convert_ieee_float_equal (const ieee_float_equal_exprt &src)
106
+ {
107
+ }
108
+
109
+ /* ******************************************************************\
110
+
111
+ Function: float_bvt::convert_ieee_float_notequal
112
+
113
+ Inputs:
114
+
115
+ Outputs:
116
+
117
+ Purpose:
118
+
119
+ \*******************************************************************/
120
+
121
+ // exprt float_bvt::convert_ieee_float_notequal(const ieee_float_notequal_exprt &src)
122
+ // {
123
+ // }
0 commit comments