X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=isl_power_templ.c;h=65253bdcb969ff69bec3c7e331449d0f5baafb07;hb=7bc3560a92635b5dcf7eb9e7329992fc935a1ce2;hp=b9fc559d54e278896fa071f69e42ed252e15f730;hpb=93c83fafbccf2929a99e8a2c86d3116fd7e8cc43;p=platform%2Fupstream%2Fisl.git diff --git a/isl_power_templ.c b/isl_power_templ.c index b9fc559..65253bd 100644 --- a/isl_power_templ.c +++ b/isl_power_templ.c @@ -1,3 +1,5 @@ +#include + #define xFN(TYPE,NAME) TYPE ## _ ## NAME #define FN(TYPE,NAME) xFN(TYPE,NAME) @@ -56,3 +58,24 @@ error: FN(TYPE,free)(map); return NULL; } + +/* Compute the given non-zero power of "map" and return the result. + * If the exponent "exp" is negative, then the -exp th power of the inverse + * relation is computed. + */ +__isl_give TYPE *FN(TYPE,fixed_power_val)(__isl_take TYPE *map, + __isl_take isl_val *exp) +{ + if (!map || !exp) + goto error; + if (!isl_val_is_int(exp)) + isl_die(FN(TYPE,get_ctx)(map), isl_error_invalid, + "expecting integer exponent", goto error); + map = FN(TYPE,fixed_power)(map, exp->n); + isl_val_free(exp); + return map; +error: + FN(TYPE,free)(map); + isl_val_free(exp); + return NULL; +}