void isl_imath_submul_ui(mp_int rop, mp_int op1, unsigned long op2) { isl_int temp; isl_int_init(temp); isl_int_set_ui(temp, op2); isl_int_submul(rop, op1, temp); isl_int_clear(temp); }
__isl_give isl_basic_set *isl_basic_set_box_from_points( __isl_take isl_point *pnt1, __isl_take isl_point *pnt2) { isl_basic_set *bset; unsigned total; int i; int k; isl_int t; isl_int_init(t); if (!pnt1 || !pnt2) goto error; isl_assert(pnt1->dim->ctx, isl_dim_equal(pnt1->dim, pnt2->dim), goto error); if (isl_point_is_void(pnt1) && isl_point_is_void(pnt2)) { isl_dim *dim = isl_dim_copy(pnt1->dim); isl_point_free(pnt1); isl_point_free(pnt2); isl_int_clear(t); return isl_basic_set_empty(dim); } if (isl_point_is_void(pnt1)) { isl_point_free(pnt1); isl_int_clear(t); return isl_basic_set_from_point(pnt2); } if (isl_point_is_void(pnt2)) { isl_point_free(pnt2); isl_int_clear(t); return isl_basic_set_from_point(pnt1); } total = isl_dim_total(pnt1->dim); bset = isl_basic_set_alloc_dim(isl_dim_copy(pnt1->dim), 0, 0, 2 * total); for (i = 0; i < total; ++i) { isl_int_mul(t, pnt1->vec->el[1 + i], pnt2->vec->el[0]); isl_int_submul(t, pnt2->vec->el[1 + i], pnt1->vec->el[0]); k = isl_basic_set_alloc_inequality(bset); if (k < 0) goto error; isl_seq_clr(bset->ineq[k] + 1, total); if (isl_int_is_pos(t)) { isl_int_set_si(bset->ineq[k][1 + i], -1); isl_int_set(bset->ineq[k][0], pnt1->vec->el[1 + i]); } else { isl_int_set_si(bset->ineq[k][1 + i], 1); isl_int_neg(bset->ineq[k][0], pnt1->vec->el[1 + i]); } isl_int_fdiv_q(bset->ineq[k][0], bset->ineq[k][0], pnt1->vec->el[0]); k = isl_basic_set_alloc_inequality(bset); if (k < 0) goto error; isl_seq_clr(bset->ineq[k] + 1, total); if (isl_int_is_pos(t)) { isl_int_set_si(bset->ineq[k][1 + i], 1); isl_int_neg(bset->ineq[k][0], pnt2->vec->el[1 + i]); } else { isl_int_set_si(bset->ineq[k][1 + i], -1); isl_int_set(bset->ineq[k][0], pnt2->vec->el[1 + i]); } isl_int_fdiv_q(bset->ineq[k][0], bset->ineq[k][0], pnt2->vec->el[0]); } bset = isl_basic_set_finalize(bset); isl_point_free(pnt1); isl_point_free(pnt2); isl_int_clear(t); return bset; error: isl_point_free(pnt1); isl_point_free(pnt2); isl_int_clear(t); return NULL; }