1 #include <isl_pw_macro.h>
3 /* Fix the value of the given parameter or domain dimension of "pw"
4 * to be equal to "value".
6 __isl_give PW
*FN(PW
,fix_si
)(__isl_take PW
*pw
, enum isl_dim_type type
,
7 unsigned pos
, int value
)
12 n
= FN(PW
,n_piece
)(pw
);
14 return FN(PW
,free
)(pw
);
16 if (type
== isl_dim_out
)
17 isl_die(FN(PW
,get_ctx
)(pw
), isl_error_invalid
,
18 "cannot fix output dimension", return FN(PW
,free
)(pw
));
20 if (type
== isl_dim_in
)
23 for (i
= n
- 1; i
>= 0; --i
) {
26 domain
= FN(PW
,take_domain_at
)(pw
, i
);
27 domain
= isl_set_fix_si(domain
, type
, pos
, value
);
28 pw
= FN(PW
,restore_domain_at
)(pw
, i
, domain
);
29 pw
= FN(PW
,exploit_equalities_and_remove_if_empty
)(pw
, i
);
35 /* Fix the value of the variable at position "pos" of type "type" of "pw"
38 __isl_give PW
*FN(PW
,fix_val
)(__isl_take PW
*pw
,
39 enum isl_dim_type type
, unsigned pos
, __isl_take isl_val
*v
)
45 return FN(PW
,free
)(pw
);
46 if (!isl_val_is_int(v
))
47 isl_die(FN(PW
,get_ctx
)(pw
), isl_error_invalid
,
48 "expecting integer value", goto error
);
50 n
= FN(PW
,n_piece
)(pw
);
54 if (type
== isl_dim_in
)
57 for (i
= 0; i
< n
; ++i
) {
60 domain
= FN(PW
,take_domain_at
)(pw
, i
);
61 domain
= isl_set_fix(domain
, type
, pos
, v
->n
);
62 pw
= FN(PW
,restore_domain_at
)(pw
, i
, domain
);
63 pw
= FN(PW
,exploit_equalities_and_remove_if_empty
)(pw
, i
);
70 return FN(PW
,free
)(pw
);