File tree 1 file changed +7
-16
lines changed
1 file changed +7
-16
lines changed Original file line number Diff line number Diff line change @@ -2097,23 +2097,14 @@ Function: zero_extend
2097
2097
2098
2098
static exprt zero_extend (const exprt &expr, const typet &type)
2099
2099
{
2100
- auto old_width = expr.type ().id () == ID_bool ? 1
2101
- : expr.type ().id () == ID_integer
2102
- ? 32
2103
- : to_bitvector_type (expr.type ()).get_width ();
2104
-
2105
- // first make unsigned
2106
- typet tmp_type;
2107
-
2108
- if (type.id () == ID_unsignedbv)
2109
- tmp_type = unsignedbv_typet{old_width};
2110
- else if (type.id () == ID_verilog_unsignedbv)
2111
- tmp_type = verilog_unsignedbv_typet{old_width};
2112
- else
2113
- PRECONDITION (false );
2100
+ exprt result = expr;
2101
+
2102
+ if (expr.type ().id () == ID_bool)
2103
+ result = typecast_exprt{expr, unsignedbv_typet{1 }};
2104
+ else if (expr.type ().id () == ID_integer)
2105
+ result = typecast_exprt{expr, unsignedbv_typet{32 }};
2114
2106
2115
- return typecast_exprt::conditional_cast (
2116
- typecast_exprt::conditional_cast (expr, tmp_type), type);
2107
+ return zero_extend_exprt{std::move (result), type};
2117
2108
}
2118
2109
2119
2110
/* ******************************************************************\
You can’t perform that action at this time.
0 commit comments