isl_qpolynomial_fold_fold_on_domain: do not consider zero to dominate NaN
[isl.git] / isl_obj.c
blob5bc26ce6cc788ae9f291da41e90169bd9b703f2e
1 /*
2 * Copyright 2010 INRIA Saclay
3 * Copyright 2014 Ecole Normale Superieure
5 * Use of this software is governed by the MIT license
7 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
8 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
9 * 91893 Orsay, France
10 * and Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
13 #include <isl/aff.h>
14 #include <isl/set.h>
15 #include <isl/map.h>
16 #include <isl/polynomial.h>
17 #include <isl/obj.h>
19 static void *isl_obj_val_copy(void *v)
21 return isl_val_copy((isl_val *)v);
24 static void isl_obj_val_free(void *v)
26 isl_val_free((isl_val *)v);
29 static __isl_give isl_printer *isl_obj_val_print(__isl_take isl_printer *p,
30 void *v)
32 return isl_printer_print_val(p, (isl_val *)v);
35 static void *isl_obj_val_add(void *v1, void *v2)
37 return isl_val_add((isl_val *) v1, (isl_val *) v2);
40 struct isl_obj_vtable isl_obj_val_vtable = {
41 isl_obj_val_copy,
42 isl_obj_val_add,
43 isl_obj_val_print,
44 isl_obj_val_free
47 static void *isl_obj_map_copy(void *v)
49 return isl_map_copy((struct isl_map *)v);
52 static void isl_obj_map_free(void *v)
54 isl_map_free((struct isl_map *)v);
57 static __isl_give isl_printer *isl_obj_map_print(__isl_take isl_printer *p,
58 void *v)
60 return isl_printer_print_map(p, (struct isl_map *)v);
63 static void *isl_obj_map_add(void *v1, void *v2)
65 return isl_map_union((struct isl_map *)v1, (struct isl_map *)v2);
68 struct isl_obj_vtable isl_obj_map_vtable = {
69 isl_obj_map_copy,
70 isl_obj_map_add,
71 isl_obj_map_print,
72 isl_obj_map_free
75 static void *isl_obj_union_map_copy(void *v)
77 return isl_union_map_copy((isl_union_map *)v);
80 static void isl_obj_union_map_free(void *v)
82 isl_union_map_free((isl_union_map *)v);
85 static __isl_give isl_printer *isl_obj_union_map_print(__isl_take isl_printer *p,
86 void *v)
88 return isl_printer_print_union_map(p, (isl_union_map *)v);
91 static void *isl_obj_union_map_add(void *v1, void *v2)
93 return isl_union_map_union((isl_union_map *)v1, (isl_union_map *)v2);
96 struct isl_obj_vtable isl_obj_union_map_vtable = {
97 isl_obj_union_map_copy,
98 isl_obj_union_map_add,
99 isl_obj_union_map_print,
100 isl_obj_union_map_free
103 static void *isl_obj_set_copy(void *v)
105 return isl_set_copy((struct isl_set *)v);
108 static void isl_obj_set_free(void *v)
110 isl_set_free((struct isl_set *)v);
113 static __isl_give isl_printer *isl_obj_set_print(__isl_take isl_printer *p,
114 void *v)
116 return isl_printer_print_set(p, (struct isl_set *)v);
119 static void *isl_obj_set_add(void *v1, void *v2)
121 return isl_set_union((struct isl_set *)v1, (struct isl_set *)v2);
124 struct isl_obj_vtable isl_obj_set_vtable = {
125 isl_obj_set_copy,
126 isl_obj_set_add,
127 isl_obj_set_print,
128 isl_obj_set_free
131 static void *isl_obj_union_set_copy(void *v)
133 return isl_union_set_copy((isl_union_set *)v);
136 static void isl_obj_union_set_free(void *v)
138 isl_union_set_free((isl_union_set *)v);
141 static __isl_give isl_printer *isl_obj_union_set_print(__isl_take isl_printer *p,
142 void *v)
144 return isl_printer_print_union_set(p, (isl_union_set *)v);
147 static void *isl_obj_union_set_add(void *v1, void *v2)
149 return isl_union_set_union((isl_union_set *)v1, (isl_union_set *)v2);
152 struct isl_obj_vtable isl_obj_union_set_vtable = {
153 isl_obj_union_set_copy,
154 isl_obj_union_set_add,
155 isl_obj_union_set_print,
156 isl_obj_union_set_free
159 static void *isl_obj_pw_multi_aff_copy(void *v)
161 return isl_pw_multi_aff_copy((isl_pw_multi_aff *) v);
164 static void isl_obj_pw_multi_aff_free(void *v)
166 isl_pw_multi_aff_free((isl_pw_multi_aff *) v);
169 static __isl_give isl_printer *isl_obj_pw_multi_aff_print(
170 __isl_take isl_printer *p, void *v)
172 return isl_printer_print_pw_multi_aff(p, (isl_pw_multi_aff *) v);
175 static void *isl_obj_pw_multi_aff_add(void *v1, void *v2)
177 return isl_pw_multi_aff_add((isl_pw_multi_aff *) v1,
178 (isl_pw_multi_aff *) v2);
181 struct isl_obj_vtable isl_obj_pw_multi_aff_vtable = {
182 isl_obj_pw_multi_aff_copy,
183 isl_obj_pw_multi_aff_add,
184 isl_obj_pw_multi_aff_print,
185 isl_obj_pw_multi_aff_free
188 static void *isl_obj_none_copy(void *v)
190 return v;
193 static void isl_obj_none_free(void *v)
197 static __isl_give isl_printer *isl_obj_none_print(__isl_take isl_printer *p,
198 void *v)
200 return p;
203 static void *isl_obj_none_add(void *v1, void *v2)
205 return NULL;
208 struct isl_obj_vtable isl_obj_none_vtable = {
209 isl_obj_none_copy,
210 isl_obj_none_add,
211 isl_obj_none_print,
212 isl_obj_none_free
215 static void *isl_obj_pw_qp_copy(void *v)
217 return isl_pw_qpolynomial_copy((struct isl_pw_qpolynomial *)v);
220 static void isl_obj_pw_qp_free(void *v)
222 isl_pw_qpolynomial_free((struct isl_pw_qpolynomial *)v);
225 static __isl_give isl_printer *isl_obj_pw_qp_print(__isl_take isl_printer *p,
226 void *v)
228 return isl_printer_print_pw_qpolynomial(p,
229 (struct isl_pw_qpolynomial *)v);
232 static void *isl_obj_pw_qp_add(void *v1, void *v2)
234 return isl_pw_qpolynomial_add((struct isl_pw_qpolynomial *)v1,
235 (struct isl_pw_qpolynomial *)v2);
238 struct isl_obj_vtable isl_obj_pw_qpolynomial_vtable = {
239 isl_obj_pw_qp_copy,
240 isl_obj_pw_qp_add,
241 isl_obj_pw_qp_print,
242 isl_obj_pw_qp_free
245 static void *isl_obj_union_pw_qp_copy(void *v)
247 return isl_union_pw_qpolynomial_copy((struct isl_union_pw_qpolynomial *)v);
250 static void isl_obj_union_pw_qp_free(void *v)
252 isl_union_pw_qpolynomial_free((struct isl_union_pw_qpolynomial *)v);
255 static __isl_give isl_printer *isl_obj_union_pw_qp_print(
256 __isl_take isl_printer *p, void *v)
258 return isl_printer_print_union_pw_qpolynomial(p,
259 (struct isl_union_pw_qpolynomial *)v);
262 static void *isl_obj_union_pw_qp_add(void *v1, void *v2)
264 return isl_union_pw_qpolynomial_add(
265 (struct isl_union_pw_qpolynomial *)v1,
266 (struct isl_union_pw_qpolynomial *)v2);
269 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_vtable = {
270 isl_obj_union_pw_qp_copy,
271 isl_obj_union_pw_qp_add,
272 isl_obj_union_pw_qp_print,
273 isl_obj_union_pw_qp_free
276 static void *isl_obj_pw_qpf_copy(void *v)
278 return isl_pw_qpolynomial_fold_copy((struct isl_pw_qpolynomial_fold *)v);
281 static void isl_obj_pw_qpf_free(void *v)
283 isl_pw_qpolynomial_fold_free((struct isl_pw_qpolynomial_fold *)v);
286 static __isl_give isl_printer *isl_obj_pw_qpf_print(__isl_take isl_printer *p,
287 void *v)
289 return isl_printer_print_pw_qpolynomial_fold(p,
290 (struct isl_pw_qpolynomial_fold *)v);
293 static void *isl_obj_pw_qpf_add(void *v1, void *v2)
295 return isl_pw_qpolynomial_fold_fold((struct isl_pw_qpolynomial_fold *)v1,
296 (struct isl_pw_qpolynomial_fold *)v2);
299 struct isl_obj_vtable isl_obj_pw_qpolynomial_fold_vtable = {
300 isl_obj_pw_qpf_copy,
301 isl_obj_pw_qpf_add,
302 isl_obj_pw_qpf_print,
303 isl_obj_pw_qpf_free
306 static void *isl_obj_union_pw_qpf_copy(void *v)
308 return isl_union_pw_qpolynomial_fold_copy((struct isl_union_pw_qpolynomial_fold *)v);
311 static void isl_obj_union_pw_qpf_free(void *v)
313 isl_union_pw_qpolynomial_fold_free((struct isl_union_pw_qpolynomial_fold *)v);
316 static __isl_give isl_printer *isl_obj_union_pw_qpf_print(
317 __isl_take isl_printer *p, void *v)
319 return isl_printer_print_union_pw_qpolynomial_fold(p,
320 (struct isl_union_pw_qpolynomial_fold *)v);
323 static void *isl_obj_union_pw_qpf_add(void *v1, void *v2)
325 return isl_union_pw_qpolynomial_fold_fold(
326 (struct isl_union_pw_qpolynomial_fold *)v1,
327 (struct isl_union_pw_qpolynomial_fold *)v2);
330 struct isl_obj_vtable isl_obj_union_pw_qpolynomial_fold_vtable = {
331 isl_obj_union_pw_qpf_copy,
332 isl_obj_union_pw_qpf_add,
333 isl_obj_union_pw_qpf_print,
334 isl_obj_union_pw_qpf_free