28 if(operands.size()!=1)
29 throw "unary minus takes one operand";
37 std::size_t op_width=op_bv.size();
39 bool no_overflow=(expr.
id()==
"no-overflow-unary-minus");
41 if(op_width==0 || op_width!=width)
45 (type.
id()==ID_vector || type.
id()==ID_complex))
51 if(sub_width==0 || width%sub_width!=0)
52 throw "unary-: unexpected vector operand width";
54 std::size_t size=width/sub_width;
58 for(std::size_t i=0; i<size; i++)
61 tmp_op.resize(sub_width);
63 for(std::size_t j=0; j<tmp_op.size(); j++)
65 assert(i*sub_width+j<op_bv.size());
66 tmp_op[j]=op_bv[i*sub_width+j];
74 tmp_result=float_utils.
negate(tmp_op);
79 assert(tmp_result.size()==sub_width);
81 for(std::size_t j=0; j<tmp_result.size(); j++)
83 assert(i*sub_width+j<bv.size());
84 bv[i*sub_width+j]=tmp_result[j];
101 return float_utils.
negate(op_bv);
The type of an expression.
boolbv_widtht boolbv_width
const irep_idt & id() const
literalt overflow_negate(const bvt &op)
virtual const bvt & convert_bv(const exprt &expr)
virtual void l_set_to(literalt a, bool value)
bvt negate(const bvt &op)
void conversion_failed(const exprt &expr, bvt &bv)
Generic base class for unary expressions.
const typet & follow(const typet &) const
bvtypet get_bvtype(const typet &type)
std::vector< exprt > operandst
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a generic typet to a floatbv_typet.
Base class for all expressions.
bvt negate_no_overflow(const bvt &op)
virtual bvt convert_unary_minus(const unary_exprt &expr)
const typet & subtype() const
std::vector< literalt > bvt