Skip to content

Commit f0b0aa2

Browse files
committed
Add invariant that multiplication uses operands of the same size
Our implementations swap operands, and determine the size of the result from the size of the operand(s). Make sure we produce consistent-width results.
1 parent a8861ed commit f0b0aa2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/solvers/flattening/bv_utils.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,11 @@ bvt bv_utilst::multiplier(
10711071
const bvt &op1,
10721072
representationt rep)
10731073
{
1074+
// We determine the result size from the operand size, and the implementation
1075+
// liberally swaps the operands, so we need to arrive at the same size
1076+
// whatever the order of the operands.
1077+
PRECONDITION(op0.size() == op1.size());
1078+
10741079
switch(rep)
10751080
{
10761081
case representationt::SIGNED: return signed_multiplier(op0, op1);

0 commit comments

Comments
 (0)