CBMC
boolbv_vector.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 
10 #include "boolbv.h"
11 
13 {
14  std::size_t width=boolbv_width(expr.type());
15 
16  const exprt::operandst &operands = expr.operands();
17 
18  bvt bv;
19  bv.reserve(width);
20 
21  if(!operands.empty())
22  {
23  std::size_t op_width = width / operands.size();
24 
25  for(const auto &op : operands)
26  {
27  const bvt &tmp = convert_bv(op, op_width);
28 
29  bv.insert(bv.end(), tmp.begin(), tmp.end());
30  }
31  }
32 
33  return bv;
34 }
bvt
std::vector< literalt > bvt
Definition: literal.h:201
boolbvt::convert_vector
virtual bvt convert_vector(const vector_exprt &expr)
Definition: boolbv_vector.cpp:12
vector_exprt
Vector constructor from list of elements.
Definition: std_expr.h:1671
exprt::type
typet & type()
Return the type of the expression.
Definition: expr.h:84
boolbvt::boolbv_width
virtual std::size_t boolbv_width(const typet &type) const
Definition: boolbv.h:102
boolbvt::convert_bv
virtual const bvt & convert_bv(const exprt &expr, const optionalt< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
Definition: boolbv.cpp:39
exprt::operandst
std::vector< exprt > operandst
Definition: expr.h:58
boolbv.h
exprt::operands
operandst & operands()
Definition: expr.h:94