Skip to content

Commit

Permalink
fix big-int bug for shift amounts, github issue 44, reported by Dejan
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
  • Loading branch information
NikolajBjorner committed Apr 20, 2015
1 parent 7d88d04 commit 6c1a539
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ast/rewriter/bit_blaster/bit_blaster_tpl_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,7 @@ template<typename Cfg>
void bit_blaster_tpl<Cfg>::mk_shl(unsigned sz, expr * const * a_bits, expr * const * b_bits, expr_ref_vector & out_bits) {
numeral k;
if (is_numeral(sz, b_bits, k)) {
if (k > numeral(sz)) k = numeral(sz);
unsigned n = static_cast<unsigned>(k.get_int64());
if (n >= sz) n = sz;
unsigned pos;
Expand Down Expand Up @@ -947,6 +948,7 @@ template<typename Cfg>
void bit_blaster_tpl<Cfg>::mk_lshr(unsigned sz, expr * const * a_bits, expr * const * b_bits, expr_ref_vector & out_bits) {
numeral k;
if (is_numeral(sz, b_bits, k)) {
if (k > numeral(sz)) k = numeral(sz);
unsigned n = static_cast<unsigned>(k.get_int64());
unsigned pos = 0;
for (unsigned i = n; i < sz; pos++, i++)
Expand Down Expand Up @@ -989,6 +991,7 @@ template<typename Cfg>
void bit_blaster_tpl<Cfg>::mk_ashr(unsigned sz, expr * const * a_bits, expr * const * b_bits, expr_ref_vector & out_bits) {
numeral k;
if (is_numeral(sz, b_bits, k)) {
if (k > numeral(sz)) k = numeral(sz);
unsigned n = static_cast<unsigned>(k.get_int64());
unsigned pos = 0;
for (unsigned i = n; i < sz; pos++, i++)
Expand Down

0 comments on commit 6c1a539

Please sign in to comment.