Skip to content

Commit b2390e4

Browse files
author
Daniel Kroening
committed
simplify_exprt::simplify_bitwise: hoist a power(...) expression
1 parent 7235f23 commit b2390e4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/util/simplify_expr_int.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,16 +781,16 @@ bool simplify_exprt::simplify_bitwise(exprt &expr)
781781

782782
if(expr.id()==ID_bitand)
783783
{
784+
const auto all_ones = power(2, width) - 1;
784785
for(exprt::operandst::iterator
785786
it=expr.operands().begin();
786787
it!=expr.operands().end();
787788
) // no it++
788789
{
789790
if(
790791
it->is_constant() &&
791-
bvrep2integer(
792-
to_constant_expr(*it).get_value(), width, false) ==
793-
power(2, width) - 1 &&
792+
bvrep2integer(to_constant_expr(*it).get_value(), width, false) ==
793+
all_ones &&
794794
expr.operands().size() > 1)
795795
{
796796
it=expr.operands().erase(it);

0 commit comments

Comments
 (0)