X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_val.c;h=dca322898e060fb609ddff05859046f868e6d0ea;hb=3d9f65131f9da197bca3a30eccf3a70107f50f03;hp=af3a781ecc0bd75de2f64dbabb2c57106f783517;hpb=b4b6b1d9c56cd90541c868ede82b450159121a8a;p=platform%2Fupstream%2Fisl.git diff --git a/isl_val.c b/isl_val.c index af3a781..dca3228 100644 --- a/isl_val.c +++ b/isl_val.c @@ -284,6 +284,21 @@ long isl_val_get_num_si(__isl_keep isl_val *v) return isl_int_get_si(v->n); } +/* Extract the numerator of a rational value "v" as an isl_int. + * + * If "v" is not a rational value, then the result is undefined. + */ +int isl_val_get_num_isl_int(__isl_keep isl_val *v, isl_int *n) +{ + if (!v) + return -1; + if (!isl_val_is_rat(v)) + isl_die(isl_val_get_ctx(v), isl_error_invalid, + "expecting rational value", return -1); + isl_int_set(*n, v->n); + return 0; +} + /* Extract the denominator of a rational value "v" as an integer. * * If "v" is not a rational value, then the result is undefined. @@ -749,6 +764,17 @@ error: } /* Return the product of "v1" and "v2". + * + * This is a private copy of isl_val_mul for use in the generic + * isl_multi_*_scale_val instantiated for isl_val. + */ +__isl_give isl_val *isl_val_scale_val(__isl_take isl_val *v1, + __isl_take isl_val *v2) +{ + return isl_val_mul(v1, v2); +} + +/* Return the product of "v1" and "v2". */ __isl_give isl_val *isl_val_mul_ui(__isl_take isl_val *v1, unsigned long v2) { @@ -1411,3 +1437,11 @@ __isl_give isl_multi_val *isl_multi_val_add_val(__isl_take isl_multi_val *mv, } return isl_multi_val_fn_val(mv, &isl_val_add, v); } + +/* Reduce the elements of "mv" modulo "v". + */ +__isl_give isl_multi_val *isl_multi_val_mod_val(__isl_take isl_multi_val *mv, + __isl_take isl_val *v) +{ + return isl_multi_val_fn_val(mv, &isl_val_mod, v); +}