X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_multi_templ.c;h=d73eb50090337d5122e5d424804471249fb8315a;hb=19596bc4e5cd282b2e75d17077b1aaaeacbfd6f9;hp=720649d9f4a843250f2b1cb5c6db60d168427cd2;hpb=ed593595d0a9923d7299f7a79ac50331861a8090;p=platform%2Fupstream%2Fisl.git diff --git a/isl_multi_templ.c b/isl_multi_templ.c index 720649d..d73eb50 100644 --- a/isl_multi_templ.c +++ b/isl_multi_templ.c @@ -429,6 +429,7 @@ __isl_give MULTI(BASE) *FN(MULTI(BASE),gist_aligned)( { int i; + multi = FN(MULTI(BASE),cow)(multi); if (!multi || !context) goto error; @@ -872,3 +873,39 @@ error: isl_val_free(v); return FN(MULTI(BASE),free)(multi); } + +/* Multiply the elements of "multi" by the corresponding element of "mv" + * and return the result. + */ +__isl_give MULTI(BASE) *FN(MULTI(BASE),scale_multi_val)( + __isl_take MULTI(BASE) *multi, __isl_take isl_multi_val *mv) +{ + int i; + + if (!multi || !mv) + goto error; + + if (!isl_space_tuple_match(multi->space, isl_dim_out, + mv->space, isl_dim_set)) + isl_die(isl_multi_val_get_ctx(mv), isl_error_invalid, + "spaces don't match", goto error); + + multi = FN(MULTI(BASE),cow)(multi); + if (!multi) + return NULL; + + for (i = 0; i < multi->n; ++i) { + isl_val *v; + + v = isl_multi_val_get_val(mv, i); + multi->p[i] = FN(EL,scale_val)(multi->p[i], v); + if (!multi->p[i]) + goto error; + } + + isl_multi_val_free(mv); + return multi; +error: + isl_multi_val_free(mv); + return FN(MULTI(BASE),free)(multi); +}