X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=basis_reduction_tab.c;h=6c7b040370f396b5e1af06741aa928322d1578c4;hb=de51a9bc4da5dd3f1f9f57c2362da6f9752c44e0;hp=a3053d8e9a62accef947a77b5340bdb4e189d3b1;hpb=42b080be093dbc334e758891b07552b24c73963d;p=platform%2Fupstream%2Fisl.git diff --git a/basis_reduction_tab.c b/basis_reduction_tab.c index a3053d8..6c7b040 100644 --- a/basis_reduction_tab.c +++ b/basis_reduction_tab.c @@ -1,5 +1,15 @@ +/* + * Copyright 2008-2009 Katholieke Universiteit Leuven + * + * Use of this software is governed by the MIT license + * + * Written by Sven Verdoolaege, K.U.Leuven, Departement + * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium + */ + #include -#include "isl_seq.h" +#include +#include #include "isl_tab.h" struct tab_lp { @@ -27,7 +37,7 @@ static void get_obj_val(struct tab_lp* lp, mpq_t *F); static void delete_lp(struct tab_lp *lp); static int add_lp_row(struct tab_lp *lp, isl_int *row, int dim); static void get_alpha(struct tab_lp* lp, int row, mpq_t *alpha); -static void del_lp_row(struct tab_lp *lp); +static int del_lp_row(struct tab_lp *lp) WARN_UNUSED; static int cut_lp_to_hyperplane(struct tab_lp *lp, isl_int *row); #define GBR_LP struct tab_lp @@ -60,7 +70,6 @@ static int cut_lp_to_hyperplane(struct tab_lp *lp, isl_int *row); */ static struct isl_tab *gbr_tab(struct isl_tab *tab, struct isl_vec *row) { - int i, j; unsigned dim; struct isl_tab *prod; @@ -171,11 +180,13 @@ static int cut_lp_to_hyperplane(struct tab_lp *lp, isl_int *row) return -1; isl_int_neg(lp->row->el[0], lp->tmp); - lp->tab = isl_tab_add_eq(lp->tab, lp->row->el); + if (isl_tab_add_eq(lp->tab, lp->row->el) < 0) + return -1; isl_seq_cpy(lp->row->el + 1 + lp->dim, row, lp->dim); isl_seq_clr(lp->row->el + 1, lp->dim); - lp->tab = isl_tab_add_eq(lp->tab, lp->row->el); + if (isl_tab_add_eq(lp->tab, lp->row->el) < 0) + return -1; lp->con_offset += 2; @@ -212,7 +223,8 @@ static int add_lp_row(struct tab_lp *lp, isl_int *row, int dim) isl_seq_cpy(lp->row->el + 1, row, lp->dim); isl_seq_neg(lp->row->el + 1 + lp->dim, row, lp->dim); - lp->tab = isl_tab_add_valid_eq(lp->tab, lp->row->el); + if (isl_tab_add_valid_eq(lp->tab, lp->row->el) < 0) + return -1; return lp->neq++; } @@ -224,8 +236,8 @@ static void get_alpha(struct tab_lp* lp, int row, mpq_t *alpha) isl_int_set(mpq_denref(*alpha), lp->tab->dual->el[0]); } -static void del_lp_row(struct tab_lp *lp) +static int del_lp_row(struct tab_lp *lp) { lp->neq--; - isl_tab_rollback(lp->tab, lp->stack[lp->neq]); + return isl_tab_rollback(lp->tab, lp->stack[lp->neq]); }