Skip to content

Commit

Permalink
Fix Equal simplification in argset as well
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdrake committed Jun 5, 2015
1 parent 7eabd8b commit 3f99b88
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
14 changes: 3 additions & 11 deletions extension/boolexpr/argset.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,9 @@ BoolExprEqArgSet_Reduce(struct BoolExprEqArgSet *argset)
return y;
}

/* Equal(1, x, y) = Nand(x, y) */
if (argset->one) {
struct BoolExpr *temp = _bx_op_from(OP_AND, length, xs);
if (temp == NULL) {
free(xs); // LCOV_EXCL_LINE
return NULL; // LCOV_EXCL_LINE
}
y = Not(temp);
BoolExpr_DecRef(temp);
return y;
}
/* Equal(1, x, y) = And(x, y) */
if (argset->one)
return _bx_op_from(OP_AND, length, xs);

return _bx_op_from(OP_EQ, length, xs);
}
Expand Down
3 changes: 1 addition & 2 deletions extension/boolexpr/test/test_argset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ TEST_F(BoolExprArgSetTest, EqReduce)
BoolExprEqArgSet_Insert(f, xs[0]);
BoolExprEqArgSet_Insert(f, xs[1]);
ops[3] = BoolExprEqArgSet_Reduce(f);
EXPECT_EQ(ops[3]->kind, OP_NOT);
EXPECT_EQ(ops[3]->data.xs->items[0]->kind, OP_AND);
EXPECT_EQ(ops[3]->kind, OP_AND);

BoolExprEqArgSet_Insert(g, xs[0]);
BoolExprEqArgSet_Insert(g, xs[1]);
Expand Down

0 comments on commit 3f99b88

Please sign in to comment.