cprover
boolbv_bitreverse.cpp
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module:
4 
5 Author: Michael Tautschnig
6 
7 \*******************************************************************/
8 
9 #include "boolbv.h"
10 
11 #include <util/bitvector_expr.h>
12 
14 {
15  const std::size_t width = boolbv_width(expr.type());
16  if(width == 0)
17  return conversion_failed(expr);
18 
19  bvt bv = convert_bv(expr.op(), width);
20 
21  std::reverse(bv.begin(), bv.end());
22 
23  return bv;
24 }
API to expression classes for bitvectors.
Reverse the order of bits in a bit-vector.
virtual const bvt & convert_bv(const exprt &expr, const optionalt< std::size_t > expected_width=nullopt)
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
Definition: boolbv.cpp:40
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
Definition: boolbv.cpp:84
virtual std::size_t boolbv_width(const typet &type) const
Definition: boolbv.h:99
virtual bvt convert_bitreverse(const bitreverse_exprt &expr)
typet & type()
Return the type of the expression.
Definition: expr.h:82
const exprt & op() const
Definition: std_expr.h:293
std::vector< literalt > bvt
Definition: literal.h:201