Skip to content

Commit

Permalink
abs -> labs; fix potential truncation issue
Browse files Browse the repository at this point in the history
  • Loading branch information
bondhugula committed Jun 20, 2023
1 parent 5f02963 commit 824b854
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/constraints.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,11 +1581,11 @@ void pluto_constraints_normalize_row(PlutoConstraints *cst, int pos) {
for (i = 0; i < cst->nrows; i++) {
if (cst->val[i][0] == 0)
continue;
int rowgcd = abs(cst->val[i][0]);
int64_t rowgcd = labs(cst->val[i][0]);
for (j = 1; j < cst->ncols; j++) {
if (cst->val[i][j] == 0)
break;
rowgcd = gcd(rowgcd, abs(cst->val[i][j]));
rowgcd = gcd(rowgcd, labs(cst->val[i][j]));
}
if (i == cst->nrows) {
if (rowgcd >= 2) {
Expand Down Expand Up @@ -2426,7 +2426,7 @@ void pluto_constraints_remove_const_ub(PlutoConstraints *cst, int pos) {
if (pluto_constraints_is_ub(cst, i, pos)) {
int sum = 0;
for (j = 0; j < cst->ncols - 1 && j != pos; j++) {
sum += abs(cst->val[i][j]);
sum += labs(cst->val[i][j]);
}
if (sum == 0) {
pluto_constraints_remove_row(cst, i);
Expand Down
6 changes: 3 additions & 3 deletions lib/iss.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ PlutoConstraints **get_lin_ind_constraints(PlutoMatrix *mat, int *orthonum) {
for (j = 0; j < ortho->ncols; j++) {
if (ortho->val[0][j] == 0)
continue;
int colgcd = abs(ortho->val[0][j]);
int64_t colgcd = labs(ortho->val[0][j]);
for (i = 1; i < ortho->nrows; i++) {
if (ortho->val[i][j] == 0)
break;
colgcd = gcd(colgcd, abs(ortho->val[i][j]));
colgcd = gcd(colgcd, labs(ortho->val[i][j]));
}
if (i == ortho->nrows) {
if (colgcd > 1) {
Expand Down Expand Up @@ -291,7 +291,7 @@ int is_long_bidirectional_dep(const Dep *dep, int dim, int npar) {

pluto_constraints_free(dpolyc);

return !(retval1 && retval2 && abs(ub) <= 5 && abs(lb) <= 5);
return !(retval1 && retval2 && labs(ub) <= 5 && labs(lb) <= 5);
}

/*
Expand Down

0 comments on commit 824b854

Please sign in to comment.