12 #include <boost/dynamic_bitset.hpp>
19 using Base = boost::dynamic_bitset<uint>;
24 template<std::
size_t len>
25 explicit BVValue(
const std::array<uint, len>& a)
26 :
mValue(a.begin(), a.end()) {}
32 :
mValue(std::move(value)) {}
38 #ifdef USE_CLN_NUMBERS
39 explicit BVValue(std::size_t _width,
const cln::cl_I& _value)
41 for (std::size_t i = 0; i < _width; ++i) {
42 mValue[i] = cln::logbitp(i, _value);
46 BVValue(std::size_t _width,
const mpz_class& _value);
48 template<
typename BlockInputIterator>
49 explicit BVValue(BlockInputIterator _first, BlockInputIterator _last)
53 template<
typename Char,
typename Traits,
typename Alloc>
54 explicit BVValue(
const std::basic_string<Char, Traits, Alloc>& _s,
55 typename std::basic_string<Char, Traits, Alloc>::size_type _pos = 0,
56 typename std::basic_string<Char, Traits, Alloc>::size_type _n = std::basic_string<Char, Traits, Alloc>::npos)
60 explicit operator const Base&()
const {
74 boost::to_string(
mValue, output);
86 lowerPart <<= _n %
width();
89 return BVValue(lowerPart ^ upperPart);
100 for (std::size_t i = 0; i < repeated.
width(); ++i) {
101 repeated[i] = (*this)[i %
width()];
108 copy.resize(
width() + _n);
109 return BVValue(std::move(copy));
114 copy.resize(
width() + _n, (*
this)[
width() - 1]);
115 return BVValue(std::move(copy));
119 assert(_index <
width());
124 assert(_index <
width());
137 return shift(_other,
false,
true);
159 BVValue
operator+(
const BVValue& lhs,
const BVValue& rhs);
160 BVValue
operator*(
const BVValue& lhs,
const BVValue& rhs);
195 return lhs.
shift(rhs,
true);
199 return lhs.
shift(rhs,
false,
false);
carl is the main namespace for the library.
BVValue operator&(const BVValue &lhs, const BVValue &rhs)
Interval< Number > operator/(const Interval< Number > &lhs, const Number &rhs)
Operator for the division of an interval and a number.
Interval< Number > operator+(const Interval< Number > &lhs, const Interval< Number > &rhs)
Operator for the addition of two intervals.
bool operator<(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
BVValue operator^(const BVValue &lhs, const BVValue &rhs)
BitVector operator|(const BitVector &lhs, const BitVector &rhs)
std::ostream & operator<<(std::ostream &os, const BasicConstraint< Poly > &c)
Prints the given constraint on the given stream.
Interval< Number > operator*(const Interval< Number > &lhs, const Interval< Number > &rhs)
Operator for the multiplication of two intervals.
BVValue operator~(const BVValue &val)
BVValue operator%(const BVValue &lhs, const BVValue &rhs)
Interval< Number > operator-(const Interval< Number > &rhs)
Unary minus.
bool operator==(const BasicConstraint< P > &lhs, const BasicConstraint< P > &rhs)
BVValue operator>>(const BVValue &lhs, const BVValue &rhs)
BVValue modSigned(const BVValue &_other) const
BVValue extract(std::size_t _highest, std::size_t _lowest) const
std::string toString() const
BVValue concat(const BVValue &_other) const
BVValue repeat(std::size_t _n) const
BVValue divideUnsigned(const BVValue &_other, bool _returnRemainder=false) const
BVValue(const std::array< uint, len > &a)
std::size_t width() const
BVValue rotateLeft(std::size_t _n) const
BVValue(const std::basic_string< Char, Traits, Alloc > &_s, typename std::basic_string< Char, Traits, Alloc >::size_type _pos=0, typename std::basic_string< Char, Traits, Alloc >::size_type _n=std::basic_string< Char, Traits, Alloc >::npos)
BVValue shift(const BVValue &_other, bool _left, bool _arithmetic=false) const
BVValue rotateRight(std::size_t _n) const
BVValue extendSignedBy(std::size_t _n) const
boost::dynamic_bitset< uint > Base
BVValue extendUnsignedBy(std::size_t _n) const
BVValue rightShiftArithmetic(const BVValue &_other) const
bool operator[](std::size_t _index) const
const Base & base() const
BVValue divideSigned(const BVValue &_other) const
BVValue(std::size_t _width, uint _value=0)
BVValue(BlockInputIterator _first, BlockInputIterator _last)
BVValue remSigned(const BVValue &_other) const
Base::reference operator[](std::size_t _index)
std::size_t operator()(const carl::BVValue &_value) const