3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-11-03 13:07:53 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2014-09-18 03:53:14 -07:00
parent 4c3605421c
commit 4eadaabe64
5 changed files with 229 additions and 19 deletions

View file

@ -26,10 +26,16 @@ Revision History:
class tbv;
#define BIT_0 0x1
#define BIT_1 0x2
#define BIT_x 0x3
#define BIT_z 0x0
enum tbit {
BIT_z = 0x0,
BIT_0 = 0x1,
BIT_1 = 0x2,
BIT_x = 0x3
};
inline tbit neg(tbit t) {
return (tbit)(t ^ 0x3);
}
class tbv_manager {
friend class tbv;
@ -63,6 +69,7 @@ public:
bool contains(tbv const& a, tbv const& b) const;
bool intersect(tbv const& a, tbv const& b, tbv& result);
std::ostream& display(std::ostream& out, tbv const& b) const;
tbv* project(unsigned n, bool const* to_delete, tbv const& src);
};
class tbv: private fixed_bit_vector {
@ -91,13 +98,14 @@ public:
void set(rational const& r, unsigned hi, unsigned lo);
void set(tbv const& other, unsigned hi, unsigned lo);
unsigned operator[](unsigned idx) const { return get(idx); }
void set(unsigned index, unsigned value) {
tbit operator[](unsigned idx) const { return (tbit)get(idx); }
void set(unsigned index, tbit value) {
SASSERT(value <= 3);
fixed_bit_vector::set(2*index, (value & 2) != 0);
fixed_bit_vector::set(2*index+1, (value & 1) != 0);
}
private:
unsigned get(unsigned index) const {