@@ -1644,21 +1644,7 @@ codet java_bytecode_convert_methodt::convert_instructions(
1644
1644
else if (statement==patternt (" ?ushr" ))
1645
1645
{
1646
1646
PRECONDITION (op.size () == 2 && results.size () == 1 );
1647
- const typet type=java_type_from_char (statement[0 ]);
1648
-
1649
- const std::size_t width=type.get_size_t (ID_width);
1650
- typet target=unsignedbv_typet (width);
1651
-
1652
- exprt lhs=op[0 ];
1653
- if (lhs.type ()!=target)
1654
- lhs.make_typecast (target);
1655
- exprt rhs=op[1 ];
1656
- if (rhs.type ()!=target)
1657
- rhs.make_typecast (target);
1658
-
1659
- results[0 ]=lshr_exprt (lhs, rhs);
1660
- if (results[0 ].type ()!=op[0 ].type ())
1661
- results[0 ].make_typecast (op[0 ].type ());
1647
+ results = convert_ushr (statement, op, results);
1662
1648
}
1663
1649
else if (statement==patternt (" ?add" ))
1664
1650
{
@@ -2522,6 +2508,29 @@ codet java_bytecode_convert_methodt::convert_instructions(
2522
2508
return code;
2523
2509
}
2524
2510
2511
+ exprt::operandst &java_bytecode_convert_methodt::convert_ushr (
2512
+ const irep_idt &statement,
2513
+ const exprt::operandst &op,
2514
+ exprt::operandst &results) const
2515
+ {
2516
+ const typet type = java_type_from_char (statement[0 ]);
2517
+
2518
+ const std::size_t width = type.get_size_t (ID_width);
2519
+ typet target = unsignedbv_typet (width);
2520
+
2521
+ exprt lhs = op[0 ];
2522
+ if (lhs.type () != target)
2523
+ lhs.make_typecast (target);
2524
+ exprt rhs = op[1 ];
2525
+ if (rhs.type () != target)
2526
+ rhs.make_typecast (target);
2527
+
2528
+ results[0 ] = lshr_exprt (lhs, rhs);
2529
+ if (results[0 ].type () != op[0 ].type ())
2530
+ results[0 ].make_typecast (op[0 ].type ());
2531
+ return results;
2532
+ }
2533
+
2525
2534
codet java_bytecode_convert_methodt::convert_iinc (
2526
2535
const exprt &arg0,
2527
2536
const exprt &arg1,
0 commit comments