File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -227,12 +227,13 @@ bool exprt::is_one() const
227
227
{
228
228
if (is_constant ())
229
229
{
230
- const std::string &value= get_string (ID_value );
231
- const irep_idt &type_id= type ().id_string ();
230
+ const auto &constant_expr = to_constant_expr (* this );
231
+ const irep_idt &type_id = type ().id ();
232
232
233
233
if (type_id==ID_integer || type_id==ID_natural)
234
234
{
235
- mp_integer int_value=string2integer (value);
235
+ mp_integer int_value =
236
+ string2integer (id2string (constant_expr.get_value ()));
236
237
if (int_value==1 )
237
238
return true ;
238
239
}
@@ -245,18 +246,19 @@ bool exprt::is_one() const
245
246
}
246
247
else if (type_id==ID_unsignedbv || type_id==ID_signedbv)
247
248
{
248
- mp_integer int_value = bv2integer (value, false );
249
+ mp_integer int_value =
250
+ bv2integer (id2string (constant_expr.get_value ()), false );
249
251
if (int_value==1 )
250
252
return true ;
251
253
}
252
254
else if (type_id==ID_fixedbv)
253
255
{
254
- if (fixedbvt (to_constant_expr (* this ))== 1 )
256
+ if (fixedbvt (constant_expr) == 1 )
255
257
return true ;
256
258
}
257
259
else if (type_id==ID_floatbv)
258
260
{
259
- if (ieee_floatt (to_constant_expr (* this ))== 1 )
261
+ if (ieee_floatt (constant_expr) == 1 )
260
262
return true ;
261
263
}
262
264
}
You can’t perform that action at this time.
0 commit comments