Skip to content

Commit bd323d6

Browse files
save
1 parent f39756c commit bd323d6

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/ast/sls/bv_sls.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ namespace bv {
5555
unsigned index = m_rand(m_repair_down.size());
5656
unsigned expr_id = m_repair_down.elem_at(index);
5757
auto e = m_terms.term(expr_id);
58+
IF_VERBOSE(20, verbose_stream() << "d " << mk_bounded_pp(e, m, 1) << "\n");
5859
if (eval_is_correct(e))
5960
m_repair_down.remove(expr_id);
6061
else
@@ -64,6 +65,7 @@ namespace bv {
6465
unsigned index = m_rand(m_repair_up.size());
6566
unsigned expr_id = m_repair_up.elem_at(index);
6667
auto e = m_terms.term(expr_id);
68+
IF_VERBOSE(20, verbose_stream() << "u " << mk_bounded_pp(e, m, 1) << "\n");
6769
if (eval_is_correct(e))
6870
m_repair_up.remove(expr_id);
6971
else
@@ -76,7 +78,6 @@ namespace bv {
7678
}
7779

7880
bool sls::try_repair_down(app* e) {
79-
IF_VERBOSE(20, verbose_stream() << "d " << mk_bounded_pp(e, m, 1) << "\n");
8081
unsigned n = e->get_num_args();
8182
unsigned s = m_rand(n);
8283
for (unsigned i = 0; i < n; ++i)
@@ -97,7 +98,6 @@ namespace bv {
9798
}
9899

99100
bool sls::try_repair_up(app* e) {
100-
IF_VERBOSE(20, verbose_stream() << "u " << mk_bounded_pp(e, m, 1) << "\n");
101101
m_repair_up.remove(e->get_id());
102102
if (m_terms.is_assertion(e)) {
103103
m_repair_down.insert(e->get_id());
@@ -114,7 +114,7 @@ namespace bv {
114114
if (m.is_bool(e))
115115
return m_eval.bval0(e) == m_eval.bval1(e);
116116
if (bv.is_bv(e))
117-
return 0 == memcmp(m_eval.wval0(e).bits.data(), m_eval.wval1(e).data(), m_eval.wval0(e).nw * 8);
117+
return 0 == m_eval.wval0(e).eq(m_eval.wval1(e));
118118
UNREACHABLE();
119119
return false;
120120
}

src/ast/sls/sls_valuation.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ namespace bv {
5555
m.compare(bits.data(), nb, hi.data(), nb) < 0;
5656
}
5757

58-
bool sls_valuation::eq(sls_valuation const& other) const {
59-
SASSERT(bw == other.bw);
60-
auto c = 0 == memcmp(bits.data(), other.bits.data(), bw / 8);
58+
bool sls_valuation::eq(svector<digit_t> const& other) const {
59+
auto c = 0 == memcmp(bits.data(), other.data(), bw / 8);
6160
if (bw % 8 == 0 || !c)
6261
return c;
63-
NOT_IMPLEMENTED_YET();
64-
return false;
62+
for (unsigned i = 8 * (bw / 8); i < bw; ++i)
63+
if (get(bits, i) != get(other, i))
64+
return false;
65+
return true;
6566
}
6667

6768
void sls_valuation::clear_overflow_bits(svector<digit_t>& bits) const {

src/ast/sls/sls_valuation.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ namespace bv {
4646
void clear_overflow_bits(svector<digit_t>& bits) const;
4747
bool can_set(svector<digit_t> const& bits) const;
4848

49-
bool eq(sls_valuation const& other) const;
49+
bool eq(sls_valuation const& other) const { return eq(other.bits); }
50+
51+
bool eq(svector<digit_t> const& other) const;
5052

5153
bool gt(svector<digit_t> const& a, svector<digit_t> const& b) const {
5254
return 0 > memcmp(a.data(), b.data(), num_bytes());

0 commit comments

Comments
 (0)