cprover
bitvector_expr.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: API to expression classes for bitvectors
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
9 #include "bitvector_expr.h"
10 
11 #include "arith_tools.h"
12 #include "mathematical_types.h"
13 
15  exprt _src,
16  const irep_idt &_id,
17  const std::size_t _distance)
18  : binary_exprt(std::move(_src), _id, from_integer(_distance, integer_typet()))
19 {
20 }
21 
22 extractbit_exprt::extractbit_exprt(exprt _src, const std::size_t _index)
24  std::move(_src),
25  ID_extractbit,
26  from_integer(_index, integer_typet()))
27 {
28 }
29 
31  exprt _src,
32  const std::size_t _upper,
33  const std::size_t _lower,
34  typet _type)
35  : expr_protectedt(ID_extractbits, std::move(_type))
36 {
37  PRECONDITION(_upper >= _lower);
39  std::move(_src),
40  from_integer(_upper, integer_typet()),
41  from_integer(_lower, integer_typet()));
42 }
constant_exprt from_integer(const mp_integer &int_value, const typet &type)
Definition: arith_tools.cpp:99
API to expression classes for bitvectors.
A base class for binary expressions.
Definition: std_expr.h:551
A base class for expressions that are predicates, i.e., Boolean-typed, and that take exactly two argu...
Definition: std_expr.h:644
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:37
Base class for all expressions.
Definition: expr.h:347
Base class for all expressions.
Definition: expr.h:54
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
Definition: expr.h:140
extractbit_exprt(exprt _src, exprt _index)
Extract the _index-th least significant bit from _src.
extractbits_exprt(exprt _src, exprt _upper, exprt _lower, typet _type)
Extract the bits [_lower .
Unbounded, signed integers (mathematical integers, not bitvectors)
shift_exprt(exprt _src, const irep_idt &_id, exprt _distance)
The type of an expression, extends irept.
Definition: type.h:28
Mathematical types.
#define PRECONDITION(CONDITION)
Definition: invariant.h:464