Skip to content

Commit 5d1fc9e

Browse files
authored
Merge pull request #327 from wegank/term-parser-fix-0
Simplify modulo normalization for negative values
2 parents 7c4fbe0 + a14af8b commit 5d1fc9e

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/msolve/iofiles.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@ static int get_coefficient_ff_and_term_from_line(char *line, int32_t nterms,
746746
break;
747747
}
748748
}
749-
while (iv_tmp < 0) {
749+
iv_tmp %= field_char;
750+
if (iv_tmp < 0) {
750751
iv_tmp += field_char; //MS change int -> long int
751752
}
752753
gens->cfs[pos] = (int32_t)iv_tmp;
@@ -763,10 +764,11 @@ static int get_coefficient_ff_and_term_from_line(char *line, int32_t nterms,
763764
cf_tmp = 1;
764765
}
765766
}
766-
while (cf_tmp < 0) {
767+
cf_tmp %= field_char;
768+
if (cf_tmp < 0) {
767769
cf_tmp += field_char;
768770
}
769-
gens->cfs[pos+j] = (int32_t)(cf_tmp % field_char);
771+
gens->cfs[pos+j] = (int32_t)cf_tmp;
770772
store_exponent(term, gens, (pos+j)*gens->nvars);
771773
}
772774
// store_exponent(term, basis, ht);

0 commit comments

Comments
 (0)