Skip to content

Commit fd9b72e

Browse files
committed
btorsim: smod: compute add_urem and add_neg_urem inline
1 parent 51844c7 commit fd9b72e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/btorsim/btorsimbv.c

+3-7
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ btorsim_bv_smod (const BtorSimBitVector *a, const BtorSimBitVector *b)
20422042
assert (a->width == b->width);
20432043

20442044
BtorSimBitVector *res = 0, *not_b, *sign_a, *sign_b, *neg_a, *neg_b, *add;
2045-
BtorSimBitVector *cond_a, *cond_b, *urem, *neg_urem, *add_urem, *add_neg_urem;
2045+
BtorSimBitVector *cond_a, *cond_b, *urem, *neg_urem;
20462046
bool a_positive, b_positive;
20472047

20482048
if (a->width == 1)
@@ -2071,12 +2071,10 @@ btorsim_bv_smod (const BtorSimBitVector *a, const BtorSimBitVector *b)
20712071
: btorsim_bv_copy(b);
20722072

20732073
neg_urem = btorsim_bv_neg (urem);
2074-
add_urem = btorsim_bv_add(urem, add);
2075-
add_neg_urem = btorsim_bv_add(neg_urem, add);
20762074

20772075
res = a_positive && b_positive ? btorsim_bv_copy(urem)
2078-
: !a_positive && b_positive ? btorsim_bv_copy(add_neg_urem)
2079-
: a_positive && !b_positive ? btorsim_bv_copy(add_urem)
2076+
: !a_positive && b_positive ? btorsim_bv_add(neg_urem, add)
2077+
: a_positive && !b_positive ? btorsim_bv_add(urem, add)
20802078
: btorsim_bv_copy(neg_urem);
20812079

20822080
btorsim_bv_free (sign_a);
@@ -2088,8 +2086,6 @@ btorsim_bv_smod (const BtorSimBitVector *a, const BtorSimBitVector *b)
20882086
btorsim_bv_free (urem);
20892087
btorsim_bv_free (add);
20902088
btorsim_bv_free (neg_urem);
2091-
btorsim_bv_free (add_urem);
2092-
btorsim_bv_free (add_neg_urem);
20932089
}
20942090

20952091
assert (res);

0 commit comments

Comments
 (0)