@@ -275,11 +275,15 @@ constant_exprt smt2_convt::parse_literal(
275
275
parse_literal (src.get_sub ()[2 ], unsignedbv_typet (floatbv_type.get_e ()));
276
276
constant_exprt s3 =
277
277
parse_literal (src.get_sub ()[3 ], unsignedbv_typet (floatbv_type.get_f ()));
278
+
279
+ const auto s1_int = numeric_cast_v<mp_integer>(s1);
280
+ const auto s2_int = numeric_cast_v<mp_integer>(s2);
281
+ const auto s3_int = numeric_cast_v<mp_integer>(s3);
282
+
278
283
// stitch the bits together
279
- std::string bits=id2string (s1.get_value ())+
280
- id2string (s2.get_value ())+
281
- id2string (s3.get_value ());
282
- value=binary2integer (bits, false );
284
+ value = bitwise_or (
285
+ s1_int << (floatbv_type.get_e () + floatbv_type.get_f ()),
286
+ bitwise_or ((s2_int << floatbv_type.get_f ()), s3_int));
283
287
}
284
288
else
285
289
value=0 ;
@@ -414,13 +418,12 @@ exprt smt2_convt::parse_struct(
414
418
{
415
419
// These are just flattened, i.e., we expect to see a monster bit vector.
416
420
std::size_t total_width=boolbv_width (type);
417
- exprt l = parse_literal (src, unsignedbv_typet (total_width));
418
- if (!l.is_constant ())
419
- return nil_exprt ();
421
+ const auto l = parse_literal (src, unsignedbv_typet (total_width));
420
422
421
- irep_idt binary=to_constant_expr (l).get_value ();
422
- if (binary.size ()!=total_width)
423
- return nil_exprt ();
423
+ const irep_idt binary =
424
+ integer2binary (numeric_cast_v<mp_integer>(l), total_width);
425
+
426
+ CHECK_RETURN (binary.size () == total_width);
424
427
425
428
std::size_t offset=0 ;
426
429
@@ -2371,15 +2374,15 @@ void smt2_convt::convert_typecast(const typecast_exprt &expr)
2371
2374
significand = 1 ;
2372
2375
exponent = 0 ;
2373
2376
a.build (significand, exponent);
2374
- val.set (ID_value, integer2binary (a.pack (), a.spec .width ()));
2377
+ val.set_value ( integer2bvrep (a.pack (), a.spec .width ()));
2375
2378
2376
2379
convert_constant (val);
2377
2380
out << " " ;
2378
2381
2379
2382
significand = 0 ;
2380
2383
exponent = 0 ;
2381
2384
a.build (significand, exponent);
2382
- val.set (ID_value, integer2binary (a.pack (), a.spec .width ()));
2385
+ val.set_value ( integer2bvrep (a.pack (), a.spec .width ()));
2383
2386
2384
2387
convert_constant (val);
2385
2388
out << " )" ;
@@ -2780,7 +2783,7 @@ void smt2_convt::convert_constant(const constant_exprt &expr)
2780
2783
}
2781
2784
else if (expr_type.id ()==ID_pointer)
2782
2785
{
2783
- const irep_idt &value= expr.get (ID_value );
2786
+ const irep_idt &value = expr.get_value ( );
2784
2787
2785
2788
if (value==ID_NULL)
2786
2789
{
@@ -3110,7 +3113,7 @@ void smt2_convt::convert_rounding_mode_FPA(const exprt &expr)
3110
3113
{
3111
3114
const constant_exprt &cexpr=to_constant_expr (expr);
3112
3115
3113
- mp_integer value= binary2integer ( id2string ( cexpr. get_value ()), false );
3116
+ mp_integer value = numeric_cast_v<mp_integer>( cexpr);
3114
3117
3115
3118
if (value==0 )
3116
3119
out << " roundNearestTiesToEven" ;
0 commit comments