1use crate::bindings::{Aff, Context, DimType, Id, LocalSpace, Map, Point, Set, Space, Val};
5use libc::uintptr_t;
6use std::ffi::{CStr, CString};
7use std::os::raw::c_char;
8
9pub struct PwAff {
11 pub ptr: uintptr_t,
12 pub should_free_on_drop: bool,
13}
14
15extern "C" {
16
17 fn isl_pw_aff_get_ctx(pwaff: uintptr_t) -> uintptr_t;
18
19 fn isl_pw_aff_get_hash(pa: uintptr_t) -> u32;
20
21 fn isl_pw_aff_get_domain_space(pwaff: uintptr_t) -> uintptr_t;
22
23 fn isl_pw_aff_get_space(pwaff: uintptr_t) -> uintptr_t;
24
25 fn isl_pw_aff_from_aff(aff: uintptr_t) -> uintptr_t;
26
27 fn isl_pw_aff_empty(space: uintptr_t) -> uintptr_t;
28
29 fn isl_pw_aff_alloc(set: uintptr_t, aff: uintptr_t) -> uintptr_t;
30
31 fn isl_pw_aff_zero_on_domain(ls: uintptr_t) -> uintptr_t;
32
33 fn isl_pw_aff_var_on_domain(ls: uintptr_t, type_: DimType, pos: u32) -> uintptr_t;
34
35 fn isl_pw_aff_nan_on_domain_space(space: uintptr_t) -> uintptr_t;
36
37 fn isl_pw_aff_nan_on_domain(ls: uintptr_t) -> uintptr_t;
38
39 fn isl_pw_aff_val_on_domain(domain: uintptr_t, v: uintptr_t) -> uintptr_t;
40
41 fn isl_pw_aff_param_on_domain_id(domain: uintptr_t, id: uintptr_t) -> uintptr_t;
42
43 fn isl_pw_aff_get_dim_name(pa: uintptr_t, type_: DimType, pos: u32) -> *const c_char;
44
45 fn isl_pw_aff_has_dim_id(pa: uintptr_t, type_: DimType, pos: u32) -> i32;
46
47 fn isl_pw_aff_get_dim_id(pa: uintptr_t, type_: DimType, pos: u32) -> uintptr_t;
48
49 fn isl_pw_aff_set_dim_id(pma: uintptr_t, type_: DimType, pos: u32, id: uintptr_t) -> uintptr_t;
50
51 fn isl_pw_aff_find_dim_by_name(pa: uintptr_t, type_: DimType, name: *const c_char) -> i32;
52
53 fn isl_pw_aff_is_empty(pwaff: uintptr_t) -> i32;
54
55 fn isl_pw_aff_involves_nan(pa: uintptr_t) -> i32;
56
57 fn isl_pw_aff_plain_cmp(pa1: uintptr_t, pa2: uintptr_t) -> i32;
58
59 fn isl_pw_aff_plain_is_equal(pwaff1: uintptr_t, pwaff2: uintptr_t) -> i32;
60
61 fn isl_pw_aff_is_equal(pa1: uintptr_t, pa2: uintptr_t) -> i32;
62
63 fn isl_pw_aff_union_min(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
64
65 fn isl_pw_aff_union_max(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
66
67 fn isl_pw_aff_union_add(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
68
69 fn isl_pw_aff_copy(pwaff: uintptr_t) -> uintptr_t;
70
71 fn isl_pw_aff_free(pwaff: uintptr_t) -> uintptr_t;
72
73 fn isl_pw_aff_dim(pwaff: uintptr_t, type_: DimType) -> i32;
74
75 fn isl_pw_aff_involves_param_id(pa: uintptr_t, id: uintptr_t) -> i32;
76
77 fn isl_pw_aff_involves_dims(pwaff: uintptr_t, type_: DimType, first: u32, n: u32) -> i32;
78
79 fn isl_pw_aff_is_cst(pwaff: uintptr_t) -> i32;
80
81 fn isl_pw_aff_insert_domain(pa: uintptr_t, domain: uintptr_t) -> uintptr_t;
82
83 fn isl_pw_aff_project_domain_on_params(pa: uintptr_t) -> uintptr_t;
84
85 fn isl_pw_aff_align_params(pwaff: uintptr_t, model: uintptr_t) -> uintptr_t;
86
87 fn isl_pw_aff_drop_unused_params(pa: uintptr_t) -> uintptr_t;
88
89 fn isl_pw_aff_has_tuple_id(pa: uintptr_t, type_: DimType) -> i32;
90
91 fn isl_pw_aff_get_tuple_id(pa: uintptr_t, type_: DimType) -> uintptr_t;
92
93 fn isl_pw_aff_set_tuple_id(pwaff: uintptr_t, type_: DimType, id: uintptr_t) -> uintptr_t;
94
95 fn isl_pw_aff_reset_tuple_id(pa: uintptr_t, type_: DimType) -> uintptr_t;
96
97 fn isl_pw_aff_reset_user(pa: uintptr_t) -> uintptr_t;
98
99 fn isl_pw_aff_params(pwa: uintptr_t) -> uintptr_t;
100
101 fn isl_pw_aff_domain(pwaff: uintptr_t) -> uintptr_t;
102
103 fn isl_pw_aff_from_range(pwa: uintptr_t) -> uintptr_t;
104
105 fn isl_pw_aff_min(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
106
107 fn isl_pw_aff_max(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
108
109 fn isl_pw_aff_mul(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
110
111 fn isl_pw_aff_div(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
112
113 fn isl_pw_aff_add(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
114
115 fn isl_pw_aff_sub(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
116
117 fn isl_pw_aff_neg(pwaff: uintptr_t) -> uintptr_t;
118
119 fn isl_pw_aff_ceil(pwaff: uintptr_t) -> uintptr_t;
120
121 fn isl_pw_aff_floor(pwaff: uintptr_t) -> uintptr_t;
122
123 fn isl_pw_aff_mod_val(pa: uintptr_t, mod_: uintptr_t) -> uintptr_t;
124
125 fn isl_pw_aff_tdiv_q(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
126
127 fn isl_pw_aff_tdiv_r(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
128
129 fn isl_pw_aff_intersect_params(pa: uintptr_t, set: uintptr_t) -> uintptr_t;
130
131 fn isl_pw_aff_intersect_domain(pa: uintptr_t, set: uintptr_t) -> uintptr_t;
132
133 fn isl_pw_aff_intersect_domain_wrapped_domain(pa: uintptr_t, set: uintptr_t) -> uintptr_t;
134
135 fn isl_pw_aff_intersect_domain_wrapped_range(pa: uintptr_t, set: uintptr_t) -> uintptr_t;
136
137 fn isl_pw_aff_subtract_domain(pa: uintptr_t, set: uintptr_t) -> uintptr_t;
138
139 fn isl_pw_aff_cond(cond: uintptr_t, pwaff_true: uintptr_t, pwaff_false: uintptr_t)
140 -> uintptr_t;
141
142 fn isl_pw_aff_add_constant_val(pa: uintptr_t, v: uintptr_t) -> uintptr_t;
143
144 fn isl_pw_aff_scale_val(pa: uintptr_t, v: uintptr_t) -> uintptr_t;
145
146 fn isl_pw_aff_scale_down_val(pa: uintptr_t, f: uintptr_t) -> uintptr_t;
147
148 fn isl_pw_aff_insert_dims(pwaff: uintptr_t, type_: DimType, first: u32, n: u32) -> uintptr_t;
149
150 fn isl_pw_aff_add_dims(pwaff: uintptr_t, type_: DimType, n: u32) -> uintptr_t;
151
152 fn isl_pw_aff_move_dims(pa: uintptr_t, dst_type: DimType, dst_pos: u32, src_type: DimType,
153 src_pos: u32, n: u32)
154 -> uintptr_t;
155
156 fn isl_pw_aff_drop_dims(pwaff: uintptr_t, type_: DimType, first: u32, n: u32) -> uintptr_t;
157
158 fn isl_pw_aff_coalesce(pa: uintptr_t) -> uintptr_t;
159
160 fn isl_pw_aff_gist(pwaff: uintptr_t, context: uintptr_t) -> uintptr_t;
161
162 fn isl_pw_aff_gist_params(pwaff: uintptr_t, context: uintptr_t) -> uintptr_t;
163
164 fn isl_pw_aff_eval(pa: uintptr_t, pnt: uintptr_t) -> uintptr_t;
165
166 fn isl_pw_aff_n_piece(pwaff: uintptr_t) -> i32;
167
168 fn isl_pw_aff_isa_aff(pa: uintptr_t) -> i32;
169
170 fn isl_pw_aff_as_aff(pa: uintptr_t) -> uintptr_t;
171
172 fn isl_pw_aff_as_map(pa: uintptr_t) -> uintptr_t;
173
174 fn isl_pw_aff_pos_set(pa: uintptr_t) -> uintptr_t;
175
176 fn isl_pw_aff_nonneg_set(pwaff: uintptr_t) -> uintptr_t;
177
178 fn isl_pw_aff_zero_set(pwaff: uintptr_t) -> uintptr_t;
179
180 fn isl_pw_aff_non_zero_set(pwaff: uintptr_t) -> uintptr_t;
181
182 fn isl_pw_aff_eq_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
183
184 fn isl_pw_aff_ne_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
185
186 fn isl_pw_aff_le_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
187
188 fn isl_pw_aff_lt_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
189
190 fn isl_pw_aff_ge_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
191
192 fn isl_pw_aff_gt_set(pwaff1: uintptr_t, pwaff2: uintptr_t) -> uintptr_t;
193
194 fn isl_pw_aff_eq_map(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
195
196 fn isl_pw_aff_le_map(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
197
198 fn isl_pw_aff_lt_map(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
199
200 fn isl_pw_aff_ge_map(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
201
202 fn isl_pw_aff_gt_map(pa1: uintptr_t, pa2: uintptr_t) -> uintptr_t;
203
204 fn isl_pw_aff_bind_id(pa: uintptr_t, id: uintptr_t) -> uintptr_t;
205
206 fn isl_pw_aff_read_from_str(ctx: uintptr_t, str_: *const c_char) -> uintptr_t;
207
208 fn isl_pw_aff_to_str(pa: uintptr_t) -> *const c_char;
209
210 fn isl_pw_aff_dump(pwaff: uintptr_t);
211
212}
213
214impl PwAff {
215 pub fn get_ctx(&self) -> Context {
217 let pwaff = self;
218 let pwaff = pwaff.ptr;
219 let isl_rs_result = unsafe { isl_pw_aff_get_ctx(pwaff) };
220 let isl_rs_result = Context { ptr: isl_rs_result,
221 should_free_on_drop: true };
222 let mut isl_rs_result = isl_rs_result;
223 isl_rs_result.do_not_free_on_drop();
224 isl_rs_result
225 }
226
227 pub fn get_hash(&self) -> u32 {
229 let pa = self;
230 let pa = pa.ptr;
231 let isl_rs_result = unsafe { isl_pw_aff_get_hash(pa) };
232 isl_rs_result
233 }
234
235 pub fn get_domain_space(&self) -> Space {
237 let pwaff = self;
238 let pwaff = pwaff.ptr;
239 let isl_rs_result = unsafe { isl_pw_aff_get_domain_space(pwaff) };
240 let isl_rs_result = Space { ptr: isl_rs_result,
241 should_free_on_drop: true };
242 isl_rs_result
243 }
244
245 pub fn get_space(&self) -> Space {
247 let pwaff = self;
248 let pwaff = pwaff.ptr;
249 let isl_rs_result = unsafe { isl_pw_aff_get_space(pwaff) };
250 let isl_rs_result = Space { ptr: isl_rs_result,
251 should_free_on_drop: true };
252 isl_rs_result
253 }
254
255 pub fn from_aff(aff: Aff) -> PwAff {
257 let mut aff = aff;
258 aff.do_not_free_on_drop();
259 let aff = aff.ptr;
260 let isl_rs_result = unsafe { isl_pw_aff_from_aff(aff) };
261 let isl_rs_result = PwAff { ptr: isl_rs_result,
262 should_free_on_drop: true };
263 isl_rs_result
264 }
265
266 pub fn empty(space: Space) -> PwAff {
268 let mut space = space;
269 space.do_not_free_on_drop();
270 let space = space.ptr;
271 let isl_rs_result = unsafe { isl_pw_aff_empty(space) };
272 let isl_rs_result = PwAff { ptr: isl_rs_result,
273 should_free_on_drop: true };
274 isl_rs_result
275 }
276
277 pub fn alloc(set: Set, aff: Aff) -> PwAff {
279 let mut set = set;
280 set.do_not_free_on_drop();
281 let set = set.ptr;
282 let mut aff = aff;
283 aff.do_not_free_on_drop();
284 let aff = aff.ptr;
285 let isl_rs_result = unsafe { isl_pw_aff_alloc(set, aff) };
286 let isl_rs_result = PwAff { ptr: isl_rs_result,
287 should_free_on_drop: true };
288 isl_rs_result
289 }
290
291 pub fn zero_on_domain(ls: LocalSpace) -> PwAff {
293 let mut ls = ls;
294 ls.do_not_free_on_drop();
295 let ls = ls.ptr;
296 let isl_rs_result = unsafe { isl_pw_aff_zero_on_domain(ls) };
297 let isl_rs_result = PwAff { ptr: isl_rs_result,
298 should_free_on_drop: true };
299 isl_rs_result
300 }
301
302 pub fn var_on_domain(ls: LocalSpace, type_: DimType, pos: u32) -> PwAff {
304 let mut ls = ls;
305 ls.do_not_free_on_drop();
306 let ls = ls.ptr;
307 let isl_rs_result = unsafe { isl_pw_aff_var_on_domain(ls, type_, pos) };
308 let isl_rs_result = PwAff { ptr: isl_rs_result,
309 should_free_on_drop: true };
310 isl_rs_result
311 }
312
313 pub fn nan_on_domain_space(space: Space) -> PwAff {
315 let mut space = space;
316 space.do_not_free_on_drop();
317 let space = space.ptr;
318 let isl_rs_result = unsafe { isl_pw_aff_nan_on_domain_space(space) };
319 let isl_rs_result = PwAff { ptr: isl_rs_result,
320 should_free_on_drop: true };
321 isl_rs_result
322 }
323
324 pub fn nan_on_domain(ls: LocalSpace) -> PwAff {
326 let mut ls = ls;
327 ls.do_not_free_on_drop();
328 let ls = ls.ptr;
329 let isl_rs_result = unsafe { isl_pw_aff_nan_on_domain(ls) };
330 let isl_rs_result = PwAff { ptr: isl_rs_result,
331 should_free_on_drop: true };
332 isl_rs_result
333 }
334
335 pub fn val_on_domain(domain: Set, v: Val) -> PwAff {
337 let mut domain = domain;
338 domain.do_not_free_on_drop();
339 let domain = domain.ptr;
340 let mut v = v;
341 v.do_not_free_on_drop();
342 let v = v.ptr;
343 let isl_rs_result = unsafe { isl_pw_aff_val_on_domain(domain, v) };
344 let isl_rs_result = PwAff { ptr: isl_rs_result,
345 should_free_on_drop: true };
346 isl_rs_result
347 }
348
349 pub fn param_on_domain_id(domain: Set, id: Id) -> PwAff {
351 let mut domain = domain;
352 domain.do_not_free_on_drop();
353 let domain = domain.ptr;
354 let mut id = id;
355 id.do_not_free_on_drop();
356 let id = id.ptr;
357 let isl_rs_result = unsafe { isl_pw_aff_param_on_domain_id(domain, id) };
358 let isl_rs_result = PwAff { ptr: isl_rs_result,
359 should_free_on_drop: true };
360 isl_rs_result
361 }
362
363 pub fn get_dim_name(&self, type_: DimType, pos: u32) -> &str {
365 let pa = self;
366 let pa = pa.ptr;
367 let isl_rs_result = unsafe { isl_pw_aff_get_dim_name(pa, type_, pos) };
368 let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
369 let isl_rs_result = isl_rs_result.to_str().unwrap();
370 isl_rs_result
371 }
372
373 pub fn has_dim_id(&self, type_: DimType, pos: u32) -> bool {
375 let pa = self;
376 let pa = pa.ptr;
377 let isl_rs_result = unsafe { isl_pw_aff_has_dim_id(pa, type_, pos) };
378 let isl_rs_result = match isl_rs_result {
379 0 => false,
380 1 => true,
381 _ => panic!("Got isl_bool = -1"),
382 };
383 isl_rs_result
384 }
385
386 pub fn get_dim_id(&self, type_: DimType, pos: u32) -> Id {
388 let pa = self;
389 let pa = pa.ptr;
390 let isl_rs_result = unsafe { isl_pw_aff_get_dim_id(pa, type_, pos) };
391 let isl_rs_result = Id { ptr: isl_rs_result,
392 should_free_on_drop: true };
393 isl_rs_result
394 }
395
396 pub fn set_dim_id(self, type_: DimType, pos: u32, id: Id) -> PwAff {
398 let pma = self;
399 let mut pma = pma;
400 pma.do_not_free_on_drop();
401 let pma = pma.ptr;
402 let mut id = id;
403 id.do_not_free_on_drop();
404 let id = id.ptr;
405 let isl_rs_result = unsafe { isl_pw_aff_set_dim_id(pma, type_, pos, id) };
406 let isl_rs_result = PwAff { ptr: isl_rs_result,
407 should_free_on_drop: true };
408 isl_rs_result
409 }
410
411 pub fn find_dim_by_name(&self, type_: DimType, name: &str) -> i32 {
413 let pa = self;
414 let pa = pa.ptr;
415 let name = CString::new(name).unwrap();
416 let name = name.as_ptr();
417 let isl_rs_result = unsafe { isl_pw_aff_find_dim_by_name(pa, type_, name) };
418 isl_rs_result
419 }
420
421 pub fn is_empty(&self) -> bool {
423 let pwaff = self;
424 let pwaff = pwaff.ptr;
425 let isl_rs_result = unsafe { isl_pw_aff_is_empty(pwaff) };
426 let isl_rs_result = match isl_rs_result {
427 0 => false,
428 1 => true,
429 _ => panic!("Got isl_bool = -1"),
430 };
431 isl_rs_result
432 }
433
434 pub fn involves_nan(&self) -> bool {
436 let pa = self;
437 let pa = pa.ptr;
438 let isl_rs_result = unsafe { isl_pw_aff_involves_nan(pa) };
439 let isl_rs_result = match isl_rs_result {
440 0 => false,
441 1 => true,
442 _ => panic!("Got isl_bool = -1"),
443 };
444 isl_rs_result
445 }
446
447 pub fn plain_cmp(&self, pa2: &PwAff) -> i32 {
449 let pa1 = self;
450 let pa1 = pa1.ptr;
451 let pa2 = pa2.ptr;
452 let isl_rs_result = unsafe { isl_pw_aff_plain_cmp(pa1, pa2) };
453 isl_rs_result
454 }
455
456 pub fn plain_is_equal(&self, pwaff2: &PwAff) -> bool {
458 let pwaff1 = self;
459 let pwaff1 = pwaff1.ptr;
460 let pwaff2 = pwaff2.ptr;
461 let isl_rs_result = unsafe { isl_pw_aff_plain_is_equal(pwaff1, pwaff2) };
462 let isl_rs_result = match isl_rs_result {
463 0 => false,
464 1 => true,
465 _ => panic!("Got isl_bool = -1"),
466 };
467 isl_rs_result
468 }
469
470 pub fn is_equal(&self, pa2: &PwAff) -> bool {
472 let pa1 = self;
473 let pa1 = pa1.ptr;
474 let pa2 = pa2.ptr;
475 let isl_rs_result = unsafe { isl_pw_aff_is_equal(pa1, pa2) };
476 let isl_rs_result = match isl_rs_result {
477 0 => false,
478 1 => true,
479 _ => panic!("Got isl_bool = -1"),
480 };
481 isl_rs_result
482 }
483
484 pub fn union_min(self, pwaff2: PwAff) -> PwAff {
486 let pwaff1 = self;
487 let mut pwaff1 = pwaff1;
488 pwaff1.do_not_free_on_drop();
489 let pwaff1 = pwaff1.ptr;
490 let mut pwaff2 = pwaff2;
491 pwaff2.do_not_free_on_drop();
492 let pwaff2 = pwaff2.ptr;
493 let isl_rs_result = unsafe { isl_pw_aff_union_min(pwaff1, pwaff2) };
494 let isl_rs_result = PwAff { ptr: isl_rs_result,
495 should_free_on_drop: true };
496 isl_rs_result
497 }
498
499 pub fn union_max(self, pwaff2: PwAff) -> PwAff {
501 let pwaff1 = self;
502 let mut pwaff1 = pwaff1;
503 pwaff1.do_not_free_on_drop();
504 let pwaff1 = pwaff1.ptr;
505 let mut pwaff2 = pwaff2;
506 pwaff2.do_not_free_on_drop();
507 let pwaff2 = pwaff2.ptr;
508 let isl_rs_result = unsafe { isl_pw_aff_union_max(pwaff1, pwaff2) };
509 let isl_rs_result = PwAff { ptr: isl_rs_result,
510 should_free_on_drop: true };
511 isl_rs_result
512 }
513
514 pub fn union_add(self, pwaff2: PwAff) -> PwAff {
516 let pwaff1 = self;
517 let mut pwaff1 = pwaff1;
518 pwaff1.do_not_free_on_drop();
519 let pwaff1 = pwaff1.ptr;
520 let mut pwaff2 = pwaff2;
521 pwaff2.do_not_free_on_drop();
522 let pwaff2 = pwaff2.ptr;
523 let isl_rs_result = unsafe { isl_pw_aff_union_add(pwaff1, pwaff2) };
524 let isl_rs_result = PwAff { ptr: isl_rs_result,
525 should_free_on_drop: true };
526 isl_rs_result
527 }
528
529 pub fn copy(&self) -> PwAff {
531 let pwaff = self;
532 let pwaff = pwaff.ptr;
533 let isl_rs_result = unsafe { isl_pw_aff_copy(pwaff) };
534 let isl_rs_result = PwAff { ptr: isl_rs_result,
535 should_free_on_drop: true };
536 isl_rs_result
537 }
538
539 pub fn free(self) -> PwAff {
541 let pwaff = self;
542 let mut pwaff = pwaff;
543 pwaff.do_not_free_on_drop();
544 let pwaff = pwaff.ptr;
545 let isl_rs_result = unsafe { isl_pw_aff_free(pwaff) };
546 let isl_rs_result = PwAff { ptr: isl_rs_result,
547 should_free_on_drop: true };
548 isl_rs_result
549 }
550
551 pub fn dim(&self, type_: DimType) -> i32 {
553 let pwaff = self;
554 let pwaff = pwaff.ptr;
555 let isl_rs_result = unsafe { isl_pw_aff_dim(pwaff, type_) };
556 isl_rs_result
557 }
558
559 pub fn involves_param_id(&self, id: &Id) -> bool {
561 let pa = self;
562 let pa = pa.ptr;
563 let id = id.ptr;
564 let isl_rs_result = unsafe { isl_pw_aff_involves_param_id(pa, id) };
565 let isl_rs_result = match isl_rs_result {
566 0 => false,
567 1 => true,
568 _ => panic!("Got isl_bool = -1"),
569 };
570 isl_rs_result
571 }
572
573 pub fn involves_dims(&self, type_: DimType, first: u32, n: u32) -> bool {
575 let pwaff = self;
576 let pwaff = pwaff.ptr;
577 let isl_rs_result = unsafe { isl_pw_aff_involves_dims(pwaff, type_, first, n) };
578 let isl_rs_result = match isl_rs_result {
579 0 => false,
580 1 => true,
581 _ => panic!("Got isl_bool = -1"),
582 };
583 isl_rs_result
584 }
585
586 pub fn is_cst(&self) -> bool {
588 let pwaff = self;
589 let pwaff = pwaff.ptr;
590 let isl_rs_result = unsafe { isl_pw_aff_is_cst(pwaff) };
591 let isl_rs_result = match isl_rs_result {
592 0 => false,
593 1 => true,
594 _ => panic!("Got isl_bool = -1"),
595 };
596 isl_rs_result
597 }
598
599 pub fn insert_domain(self, domain: Space) -> PwAff {
601 let pa = self;
602 let mut pa = pa;
603 pa.do_not_free_on_drop();
604 let pa = pa.ptr;
605 let mut domain = domain;
606 domain.do_not_free_on_drop();
607 let domain = domain.ptr;
608 let isl_rs_result = unsafe { isl_pw_aff_insert_domain(pa, domain) };
609 let isl_rs_result = PwAff { ptr: isl_rs_result,
610 should_free_on_drop: true };
611 isl_rs_result
612 }
613
614 pub fn project_domain_on_params(self) -> PwAff {
616 let pa = self;
617 let mut pa = pa;
618 pa.do_not_free_on_drop();
619 let pa = pa.ptr;
620 let isl_rs_result = unsafe { isl_pw_aff_project_domain_on_params(pa) };
621 let isl_rs_result = PwAff { ptr: isl_rs_result,
622 should_free_on_drop: true };
623 isl_rs_result
624 }
625
626 pub fn align_params(self, model: Space) -> PwAff {
628 let pwaff = self;
629 let mut pwaff = pwaff;
630 pwaff.do_not_free_on_drop();
631 let pwaff = pwaff.ptr;
632 let mut model = model;
633 model.do_not_free_on_drop();
634 let model = model.ptr;
635 let isl_rs_result = unsafe { isl_pw_aff_align_params(pwaff, model) };
636 let isl_rs_result = PwAff { ptr: isl_rs_result,
637 should_free_on_drop: true };
638 isl_rs_result
639 }
640
641 pub fn drop_unused_params(self) -> PwAff {
643 let pa = self;
644 let mut pa = pa;
645 pa.do_not_free_on_drop();
646 let pa = pa.ptr;
647 let isl_rs_result = unsafe { isl_pw_aff_drop_unused_params(pa) };
648 let isl_rs_result = PwAff { ptr: isl_rs_result,
649 should_free_on_drop: true };
650 isl_rs_result
651 }
652
653 pub fn has_tuple_id(&self, type_: DimType) -> bool {
655 let pa = self;
656 let pa = pa.ptr;
657 let isl_rs_result = unsafe { isl_pw_aff_has_tuple_id(pa, type_) };
658 let isl_rs_result = match isl_rs_result {
659 0 => false,
660 1 => true,
661 _ => panic!("Got isl_bool = -1"),
662 };
663 isl_rs_result
664 }
665
666 pub fn get_tuple_id(&self, type_: DimType) -> Id {
668 let pa = self;
669 let pa = pa.ptr;
670 let isl_rs_result = unsafe { isl_pw_aff_get_tuple_id(pa, type_) };
671 let isl_rs_result = Id { ptr: isl_rs_result,
672 should_free_on_drop: true };
673 isl_rs_result
674 }
675
676 pub fn set_tuple_id(self, type_: DimType, id: Id) -> PwAff {
678 let pwaff = self;
679 let mut pwaff = pwaff;
680 pwaff.do_not_free_on_drop();
681 let pwaff = pwaff.ptr;
682 let mut id = id;
683 id.do_not_free_on_drop();
684 let id = id.ptr;
685 let isl_rs_result = unsafe { isl_pw_aff_set_tuple_id(pwaff, type_, id) };
686 let isl_rs_result = PwAff { ptr: isl_rs_result,
687 should_free_on_drop: true };
688 isl_rs_result
689 }
690
691 pub fn reset_tuple_id(self, type_: DimType) -> PwAff {
693 let pa = self;
694 let mut pa = pa;
695 pa.do_not_free_on_drop();
696 let pa = pa.ptr;
697 let isl_rs_result = unsafe { isl_pw_aff_reset_tuple_id(pa, type_) };
698 let isl_rs_result = PwAff { ptr: isl_rs_result,
699 should_free_on_drop: true };
700 isl_rs_result
701 }
702
703 pub fn reset_user(self) -> PwAff {
705 let pa = self;
706 let mut pa = pa;
707 pa.do_not_free_on_drop();
708 let pa = pa.ptr;
709 let isl_rs_result = unsafe { isl_pw_aff_reset_user(pa) };
710 let isl_rs_result = PwAff { ptr: isl_rs_result,
711 should_free_on_drop: true };
712 isl_rs_result
713 }
714
715 pub fn params(self) -> Set {
717 let pwa = self;
718 let mut pwa = pwa;
719 pwa.do_not_free_on_drop();
720 let pwa = pwa.ptr;
721 let isl_rs_result = unsafe { isl_pw_aff_params(pwa) };
722 let isl_rs_result = Set { ptr: isl_rs_result,
723 should_free_on_drop: true };
724 isl_rs_result
725 }
726
727 pub fn domain(self) -> Set {
729 let pwaff = self;
730 let mut pwaff = pwaff;
731 pwaff.do_not_free_on_drop();
732 let pwaff = pwaff.ptr;
733 let isl_rs_result = unsafe { isl_pw_aff_domain(pwaff) };
734 let isl_rs_result = Set { ptr: isl_rs_result,
735 should_free_on_drop: true };
736 isl_rs_result
737 }
738
739 pub fn from_range(self) -> PwAff {
741 let pwa = self;
742 let mut pwa = pwa;
743 pwa.do_not_free_on_drop();
744 let pwa = pwa.ptr;
745 let isl_rs_result = unsafe { isl_pw_aff_from_range(pwa) };
746 let isl_rs_result = PwAff { ptr: isl_rs_result,
747 should_free_on_drop: true };
748 isl_rs_result
749 }
750
751 pub fn min(self, pwaff2: PwAff) -> PwAff {
753 let pwaff1 = self;
754 let mut pwaff1 = pwaff1;
755 pwaff1.do_not_free_on_drop();
756 let pwaff1 = pwaff1.ptr;
757 let mut pwaff2 = pwaff2;
758 pwaff2.do_not_free_on_drop();
759 let pwaff2 = pwaff2.ptr;
760 let isl_rs_result = unsafe { isl_pw_aff_min(pwaff1, pwaff2) };
761 let isl_rs_result = PwAff { ptr: isl_rs_result,
762 should_free_on_drop: true };
763 isl_rs_result
764 }
765
766 pub fn max(self, pwaff2: PwAff) -> PwAff {
768 let pwaff1 = self;
769 let mut pwaff1 = pwaff1;
770 pwaff1.do_not_free_on_drop();
771 let pwaff1 = pwaff1.ptr;
772 let mut pwaff2 = pwaff2;
773 pwaff2.do_not_free_on_drop();
774 let pwaff2 = pwaff2.ptr;
775 let isl_rs_result = unsafe { isl_pw_aff_max(pwaff1, pwaff2) };
776 let isl_rs_result = PwAff { ptr: isl_rs_result,
777 should_free_on_drop: true };
778 isl_rs_result
779 }
780
781 pub fn mul(self, pwaff2: PwAff) -> PwAff {
783 let pwaff1 = self;
784 let mut pwaff1 = pwaff1;
785 pwaff1.do_not_free_on_drop();
786 let pwaff1 = pwaff1.ptr;
787 let mut pwaff2 = pwaff2;
788 pwaff2.do_not_free_on_drop();
789 let pwaff2 = pwaff2.ptr;
790 let isl_rs_result = unsafe { isl_pw_aff_mul(pwaff1, pwaff2) };
791 let isl_rs_result = PwAff { ptr: isl_rs_result,
792 should_free_on_drop: true };
793 isl_rs_result
794 }
795
796 pub fn div(self, pa2: PwAff) -> PwAff {
798 let pa1 = self;
799 let mut pa1 = pa1;
800 pa1.do_not_free_on_drop();
801 let pa1 = pa1.ptr;
802 let mut pa2 = pa2;
803 pa2.do_not_free_on_drop();
804 let pa2 = pa2.ptr;
805 let isl_rs_result = unsafe { isl_pw_aff_div(pa1, pa2) };
806 let isl_rs_result = PwAff { ptr: isl_rs_result,
807 should_free_on_drop: true };
808 isl_rs_result
809 }
810
811 pub fn add(self, pwaff2: PwAff) -> PwAff {
813 let pwaff1 = self;
814 let mut pwaff1 = pwaff1;
815 pwaff1.do_not_free_on_drop();
816 let pwaff1 = pwaff1.ptr;
817 let mut pwaff2 = pwaff2;
818 pwaff2.do_not_free_on_drop();
819 let pwaff2 = pwaff2.ptr;
820 let isl_rs_result = unsafe { isl_pw_aff_add(pwaff1, pwaff2) };
821 let isl_rs_result = PwAff { ptr: isl_rs_result,
822 should_free_on_drop: true };
823 isl_rs_result
824 }
825
826 pub fn sub(self, pwaff2: PwAff) -> PwAff {
828 let pwaff1 = self;
829 let mut pwaff1 = pwaff1;
830 pwaff1.do_not_free_on_drop();
831 let pwaff1 = pwaff1.ptr;
832 let mut pwaff2 = pwaff2;
833 pwaff2.do_not_free_on_drop();
834 let pwaff2 = pwaff2.ptr;
835 let isl_rs_result = unsafe { isl_pw_aff_sub(pwaff1, pwaff2) };
836 let isl_rs_result = PwAff { ptr: isl_rs_result,
837 should_free_on_drop: true };
838 isl_rs_result
839 }
840
841 pub fn neg(self) -> PwAff {
843 let pwaff = self;
844 let mut pwaff = pwaff;
845 pwaff.do_not_free_on_drop();
846 let pwaff = pwaff.ptr;
847 let isl_rs_result = unsafe { isl_pw_aff_neg(pwaff) };
848 let isl_rs_result = PwAff { ptr: isl_rs_result,
849 should_free_on_drop: true };
850 isl_rs_result
851 }
852
853 pub fn ceil(self) -> PwAff {
855 let pwaff = self;
856 let mut pwaff = pwaff;
857 pwaff.do_not_free_on_drop();
858 let pwaff = pwaff.ptr;
859 let isl_rs_result = unsafe { isl_pw_aff_ceil(pwaff) };
860 let isl_rs_result = PwAff { ptr: isl_rs_result,
861 should_free_on_drop: true };
862 isl_rs_result
863 }
864
865 pub fn floor(self) -> PwAff {
867 let pwaff = self;
868 let mut pwaff = pwaff;
869 pwaff.do_not_free_on_drop();
870 let pwaff = pwaff.ptr;
871 let isl_rs_result = unsafe { isl_pw_aff_floor(pwaff) };
872 let isl_rs_result = PwAff { ptr: isl_rs_result,
873 should_free_on_drop: true };
874 isl_rs_result
875 }
876
877 pub fn mod_val(self, mod_: Val) -> PwAff {
879 let pa = self;
880 let mut pa = pa;
881 pa.do_not_free_on_drop();
882 let pa = pa.ptr;
883 let mut mod_ = mod_;
884 mod_.do_not_free_on_drop();
885 let mod_ = mod_.ptr;
886 let isl_rs_result = unsafe { isl_pw_aff_mod_val(pa, mod_) };
887 let isl_rs_result = PwAff { ptr: isl_rs_result,
888 should_free_on_drop: true };
889 isl_rs_result
890 }
891
892 pub fn tdiv_q(self, pa2: PwAff) -> PwAff {
894 let pa1 = self;
895 let mut pa1 = pa1;
896 pa1.do_not_free_on_drop();
897 let pa1 = pa1.ptr;
898 let mut pa2 = pa2;
899 pa2.do_not_free_on_drop();
900 let pa2 = pa2.ptr;
901 let isl_rs_result = unsafe { isl_pw_aff_tdiv_q(pa1, pa2) };
902 let isl_rs_result = PwAff { ptr: isl_rs_result,
903 should_free_on_drop: true };
904 isl_rs_result
905 }
906
907 pub fn tdiv_r(self, pa2: PwAff) -> PwAff {
909 let pa1 = self;
910 let mut pa1 = pa1;
911 pa1.do_not_free_on_drop();
912 let pa1 = pa1.ptr;
913 let mut pa2 = pa2;
914 pa2.do_not_free_on_drop();
915 let pa2 = pa2.ptr;
916 let isl_rs_result = unsafe { isl_pw_aff_tdiv_r(pa1, pa2) };
917 let isl_rs_result = PwAff { ptr: isl_rs_result,
918 should_free_on_drop: true };
919 isl_rs_result
920 }
921
922 pub fn intersect_params(self, set: Set) -> PwAff {
924 let pa = self;
925 let mut pa = pa;
926 pa.do_not_free_on_drop();
927 let pa = pa.ptr;
928 let mut set = set;
929 set.do_not_free_on_drop();
930 let set = set.ptr;
931 let isl_rs_result = unsafe { isl_pw_aff_intersect_params(pa, set) };
932 let isl_rs_result = PwAff { ptr: isl_rs_result,
933 should_free_on_drop: true };
934 isl_rs_result
935 }
936
937 pub fn intersect_domain(self, set: Set) -> PwAff {
939 let pa = self;
940 let mut pa = pa;
941 pa.do_not_free_on_drop();
942 let pa = pa.ptr;
943 let mut set = set;
944 set.do_not_free_on_drop();
945 let set = set.ptr;
946 let isl_rs_result = unsafe { isl_pw_aff_intersect_domain(pa, set) };
947 let isl_rs_result = PwAff { ptr: isl_rs_result,
948 should_free_on_drop: true };
949 isl_rs_result
950 }
951
952 pub fn intersect_domain_wrapped_domain(self, set: Set) -> PwAff {
954 let pa = self;
955 let mut pa = pa;
956 pa.do_not_free_on_drop();
957 let pa = pa.ptr;
958 let mut set = set;
959 set.do_not_free_on_drop();
960 let set = set.ptr;
961 let isl_rs_result = unsafe { isl_pw_aff_intersect_domain_wrapped_domain(pa, set) };
962 let isl_rs_result = PwAff { ptr: isl_rs_result,
963 should_free_on_drop: true };
964 isl_rs_result
965 }
966
967 pub fn intersect_domain_wrapped_range(self, set: Set) -> PwAff {
969 let pa = self;
970 let mut pa = pa;
971 pa.do_not_free_on_drop();
972 let pa = pa.ptr;
973 let mut set = set;
974 set.do_not_free_on_drop();
975 let set = set.ptr;
976 let isl_rs_result = unsafe { isl_pw_aff_intersect_domain_wrapped_range(pa, set) };
977 let isl_rs_result = PwAff { ptr: isl_rs_result,
978 should_free_on_drop: true };
979 isl_rs_result
980 }
981
982 pub fn subtract_domain(self, set: Set) -> PwAff {
984 let pa = self;
985 let mut pa = pa;
986 pa.do_not_free_on_drop();
987 let pa = pa.ptr;
988 let mut set = set;
989 set.do_not_free_on_drop();
990 let set = set.ptr;
991 let isl_rs_result = unsafe { isl_pw_aff_subtract_domain(pa, set) };
992 let isl_rs_result = PwAff { ptr: isl_rs_result,
993 should_free_on_drop: true };
994 isl_rs_result
995 }
996
997 pub fn cond(self, pwaff_true: PwAff, pwaff_false: PwAff) -> PwAff {
999 let cond = self;
1000 let mut cond = cond;
1001 cond.do_not_free_on_drop();
1002 let cond = cond.ptr;
1003 let mut pwaff_true = pwaff_true;
1004 pwaff_true.do_not_free_on_drop();
1005 let pwaff_true = pwaff_true.ptr;
1006 let mut pwaff_false = pwaff_false;
1007 pwaff_false.do_not_free_on_drop();
1008 let pwaff_false = pwaff_false.ptr;
1009 let isl_rs_result = unsafe { isl_pw_aff_cond(cond, pwaff_true, pwaff_false) };
1010 let isl_rs_result = PwAff { ptr: isl_rs_result,
1011 should_free_on_drop: true };
1012 isl_rs_result
1013 }
1014
1015 pub fn add_constant_val(self, v: Val) -> PwAff {
1017 let pa = self;
1018 let mut pa = pa;
1019 pa.do_not_free_on_drop();
1020 let pa = pa.ptr;
1021 let mut v = v;
1022 v.do_not_free_on_drop();
1023 let v = v.ptr;
1024 let isl_rs_result = unsafe { isl_pw_aff_add_constant_val(pa, v) };
1025 let isl_rs_result = PwAff { ptr: isl_rs_result,
1026 should_free_on_drop: true };
1027 isl_rs_result
1028 }
1029
1030 pub fn scale_val(self, v: Val) -> PwAff {
1032 let pa = self;
1033 let mut pa = pa;
1034 pa.do_not_free_on_drop();
1035 let pa = pa.ptr;
1036 let mut v = v;
1037 v.do_not_free_on_drop();
1038 let v = v.ptr;
1039 let isl_rs_result = unsafe { isl_pw_aff_scale_val(pa, v) };
1040 let isl_rs_result = PwAff { ptr: isl_rs_result,
1041 should_free_on_drop: true };
1042 isl_rs_result
1043 }
1044
1045 pub fn scale_down_val(self, f: Val) -> PwAff {
1047 let pa = self;
1048 let mut pa = pa;
1049 pa.do_not_free_on_drop();
1050 let pa = pa.ptr;
1051 let mut f = f;
1052 f.do_not_free_on_drop();
1053 let f = f.ptr;
1054 let isl_rs_result = unsafe { isl_pw_aff_scale_down_val(pa, f) };
1055 let isl_rs_result = PwAff { ptr: isl_rs_result,
1056 should_free_on_drop: true };
1057 isl_rs_result
1058 }
1059
1060 pub fn insert_dims(self, type_: DimType, first: u32, n: u32) -> PwAff {
1062 let pwaff = self;
1063 let mut pwaff = pwaff;
1064 pwaff.do_not_free_on_drop();
1065 let pwaff = pwaff.ptr;
1066 let isl_rs_result = unsafe { isl_pw_aff_insert_dims(pwaff, type_, first, n) };
1067 let isl_rs_result = PwAff { ptr: isl_rs_result,
1068 should_free_on_drop: true };
1069 isl_rs_result
1070 }
1071
1072 pub fn add_dims(self, type_: DimType, n: u32) -> PwAff {
1074 let pwaff = self;
1075 let mut pwaff = pwaff;
1076 pwaff.do_not_free_on_drop();
1077 let pwaff = pwaff.ptr;
1078 let isl_rs_result = unsafe { isl_pw_aff_add_dims(pwaff, type_, n) };
1079 let isl_rs_result = PwAff { ptr: isl_rs_result,
1080 should_free_on_drop: true };
1081 isl_rs_result
1082 }
1083
1084 pub fn move_dims(self, dst_type: DimType, dst_pos: u32, src_type: DimType, src_pos: u32,
1086 n: u32)
1087 -> PwAff {
1088 let pa = self;
1089 let mut pa = pa;
1090 pa.do_not_free_on_drop();
1091 let pa = pa.ptr;
1092 let isl_rs_result =
1093 unsafe { isl_pw_aff_move_dims(pa, dst_type, dst_pos, src_type, src_pos, n) };
1094 let isl_rs_result = PwAff { ptr: isl_rs_result,
1095 should_free_on_drop: true };
1096 isl_rs_result
1097 }
1098
1099 pub fn drop_dims(self, type_: DimType, first: u32, n: u32) -> PwAff {
1101 let pwaff = self;
1102 let mut pwaff = pwaff;
1103 pwaff.do_not_free_on_drop();
1104 let pwaff = pwaff.ptr;
1105 let isl_rs_result = unsafe { isl_pw_aff_drop_dims(pwaff, type_, first, n) };
1106 let isl_rs_result = PwAff { ptr: isl_rs_result,
1107 should_free_on_drop: true };
1108 isl_rs_result
1109 }
1110
1111 pub fn coalesce(self) -> PwAff {
1113 let pa = self;
1114 let mut pa = pa;
1115 pa.do_not_free_on_drop();
1116 let pa = pa.ptr;
1117 let isl_rs_result = unsafe { isl_pw_aff_coalesce(pa) };
1118 let isl_rs_result = PwAff { ptr: isl_rs_result,
1119 should_free_on_drop: true };
1120 isl_rs_result
1121 }
1122
1123 pub fn gist(self, context: Set) -> PwAff {
1125 let pwaff = self;
1126 let mut pwaff = pwaff;
1127 pwaff.do_not_free_on_drop();
1128 let pwaff = pwaff.ptr;
1129 let mut context = context;
1130 context.do_not_free_on_drop();
1131 let context = context.ptr;
1132 let isl_rs_result = unsafe { isl_pw_aff_gist(pwaff, context) };
1133 let isl_rs_result = PwAff { ptr: isl_rs_result,
1134 should_free_on_drop: true };
1135 isl_rs_result
1136 }
1137
1138 pub fn gist_params(self, context: Set) -> PwAff {
1140 let pwaff = self;
1141 let mut pwaff = pwaff;
1142 pwaff.do_not_free_on_drop();
1143 let pwaff = pwaff.ptr;
1144 let mut context = context;
1145 context.do_not_free_on_drop();
1146 let context = context.ptr;
1147 let isl_rs_result = unsafe { isl_pw_aff_gist_params(pwaff, context) };
1148 let isl_rs_result = PwAff { ptr: isl_rs_result,
1149 should_free_on_drop: true };
1150 isl_rs_result
1151 }
1152
1153 pub fn eval(self, pnt: Point) -> Val {
1155 let pa = self;
1156 let mut pa = pa;
1157 pa.do_not_free_on_drop();
1158 let pa = pa.ptr;
1159 let mut pnt = pnt;
1160 pnt.do_not_free_on_drop();
1161 let pnt = pnt.ptr;
1162 let isl_rs_result = unsafe { isl_pw_aff_eval(pa, pnt) };
1163 let isl_rs_result = Val { ptr: isl_rs_result,
1164 should_free_on_drop: true };
1165 isl_rs_result
1166 }
1167
1168 pub fn n_piece(&self) -> i32 {
1170 let pwaff = self;
1171 let pwaff = pwaff.ptr;
1172 let isl_rs_result = unsafe { isl_pw_aff_n_piece(pwaff) };
1173 isl_rs_result
1174 }
1175
1176 pub fn isa_aff(&self) -> bool {
1178 let pa = self;
1179 let pa = pa.ptr;
1180 let isl_rs_result = unsafe { isl_pw_aff_isa_aff(pa) };
1181 let isl_rs_result = match isl_rs_result {
1182 0 => false,
1183 1 => true,
1184 _ => panic!("Got isl_bool = -1"),
1185 };
1186 isl_rs_result
1187 }
1188
1189 pub fn as_aff(self) -> Aff {
1191 let pa = self;
1192 let mut pa = pa;
1193 pa.do_not_free_on_drop();
1194 let pa = pa.ptr;
1195 let isl_rs_result = unsafe { isl_pw_aff_as_aff(pa) };
1196 let isl_rs_result = Aff { ptr: isl_rs_result,
1197 should_free_on_drop: true };
1198 isl_rs_result
1199 }
1200
1201 pub fn as_map(self) -> Map {
1203 let pa = self;
1204 let mut pa = pa;
1205 pa.do_not_free_on_drop();
1206 let pa = pa.ptr;
1207 let isl_rs_result = unsafe { isl_pw_aff_as_map(pa) };
1208 let isl_rs_result = Map { ptr: isl_rs_result,
1209 should_free_on_drop: true };
1210 isl_rs_result
1211 }
1212
1213 pub fn pos_set(self) -> Set {
1215 let pa = self;
1216 let mut pa = pa;
1217 pa.do_not_free_on_drop();
1218 let pa = pa.ptr;
1219 let isl_rs_result = unsafe { isl_pw_aff_pos_set(pa) };
1220 let isl_rs_result = Set { ptr: isl_rs_result,
1221 should_free_on_drop: true };
1222 isl_rs_result
1223 }
1224
1225 pub fn nonneg_set(self) -> Set {
1227 let pwaff = self;
1228 let mut pwaff = pwaff;
1229 pwaff.do_not_free_on_drop();
1230 let pwaff = pwaff.ptr;
1231 let isl_rs_result = unsafe { isl_pw_aff_nonneg_set(pwaff) };
1232 let isl_rs_result = Set { ptr: isl_rs_result,
1233 should_free_on_drop: true };
1234 isl_rs_result
1235 }
1236
1237 pub fn zero_set(self) -> Set {
1239 let pwaff = self;
1240 let mut pwaff = pwaff;
1241 pwaff.do_not_free_on_drop();
1242 let pwaff = pwaff.ptr;
1243 let isl_rs_result = unsafe { isl_pw_aff_zero_set(pwaff) };
1244 let isl_rs_result = Set { ptr: isl_rs_result,
1245 should_free_on_drop: true };
1246 isl_rs_result
1247 }
1248
1249 pub fn non_zero_set(self) -> Set {
1251 let pwaff = self;
1252 let mut pwaff = pwaff;
1253 pwaff.do_not_free_on_drop();
1254 let pwaff = pwaff.ptr;
1255 let isl_rs_result = unsafe { isl_pw_aff_non_zero_set(pwaff) };
1256 let isl_rs_result = Set { ptr: isl_rs_result,
1257 should_free_on_drop: true };
1258 isl_rs_result
1259 }
1260
1261 pub fn eq_set(self, pwaff2: PwAff) -> Set {
1263 let pwaff1 = self;
1264 let mut pwaff1 = pwaff1;
1265 pwaff1.do_not_free_on_drop();
1266 let pwaff1 = pwaff1.ptr;
1267 let mut pwaff2 = pwaff2;
1268 pwaff2.do_not_free_on_drop();
1269 let pwaff2 = pwaff2.ptr;
1270 let isl_rs_result = unsafe { isl_pw_aff_eq_set(pwaff1, pwaff2) };
1271 let isl_rs_result = Set { ptr: isl_rs_result,
1272 should_free_on_drop: true };
1273 isl_rs_result
1274 }
1275
1276 pub fn ne_set(self, pwaff2: PwAff) -> Set {
1278 let pwaff1 = self;
1279 let mut pwaff1 = pwaff1;
1280 pwaff1.do_not_free_on_drop();
1281 let pwaff1 = pwaff1.ptr;
1282 let mut pwaff2 = pwaff2;
1283 pwaff2.do_not_free_on_drop();
1284 let pwaff2 = pwaff2.ptr;
1285 let isl_rs_result = unsafe { isl_pw_aff_ne_set(pwaff1, pwaff2) };
1286 let isl_rs_result = Set { ptr: isl_rs_result,
1287 should_free_on_drop: true };
1288 isl_rs_result
1289 }
1290
1291 pub fn le_set(self, pwaff2: PwAff) -> Set {
1293 let pwaff1 = self;
1294 let mut pwaff1 = pwaff1;
1295 pwaff1.do_not_free_on_drop();
1296 let pwaff1 = pwaff1.ptr;
1297 let mut pwaff2 = pwaff2;
1298 pwaff2.do_not_free_on_drop();
1299 let pwaff2 = pwaff2.ptr;
1300 let isl_rs_result = unsafe { isl_pw_aff_le_set(pwaff1, pwaff2) };
1301 let isl_rs_result = Set { ptr: isl_rs_result,
1302 should_free_on_drop: true };
1303 isl_rs_result
1304 }
1305
1306 pub fn lt_set(self, pwaff2: PwAff) -> Set {
1308 let pwaff1 = self;
1309 let mut pwaff1 = pwaff1;
1310 pwaff1.do_not_free_on_drop();
1311 let pwaff1 = pwaff1.ptr;
1312 let mut pwaff2 = pwaff2;
1313 pwaff2.do_not_free_on_drop();
1314 let pwaff2 = pwaff2.ptr;
1315 let isl_rs_result = unsafe { isl_pw_aff_lt_set(pwaff1, pwaff2) };
1316 let isl_rs_result = Set { ptr: isl_rs_result,
1317 should_free_on_drop: true };
1318 isl_rs_result
1319 }
1320
1321 pub fn ge_set(self, pwaff2: PwAff) -> Set {
1323 let pwaff1 = self;
1324 let mut pwaff1 = pwaff1;
1325 pwaff1.do_not_free_on_drop();
1326 let pwaff1 = pwaff1.ptr;
1327 let mut pwaff2 = pwaff2;
1328 pwaff2.do_not_free_on_drop();
1329 let pwaff2 = pwaff2.ptr;
1330 let isl_rs_result = unsafe { isl_pw_aff_ge_set(pwaff1, pwaff2) };
1331 let isl_rs_result = Set { ptr: isl_rs_result,
1332 should_free_on_drop: true };
1333 isl_rs_result
1334 }
1335
1336 pub fn gt_set(self, pwaff2: PwAff) -> Set {
1338 let pwaff1 = self;
1339 let mut pwaff1 = pwaff1;
1340 pwaff1.do_not_free_on_drop();
1341 let pwaff1 = pwaff1.ptr;
1342 let mut pwaff2 = pwaff2;
1343 pwaff2.do_not_free_on_drop();
1344 let pwaff2 = pwaff2.ptr;
1345 let isl_rs_result = unsafe { isl_pw_aff_gt_set(pwaff1, pwaff2) };
1346 let isl_rs_result = Set { ptr: isl_rs_result,
1347 should_free_on_drop: true };
1348 isl_rs_result
1349 }
1350
1351 pub fn eq_map(self, pa2: PwAff) -> Map {
1353 let pa1 = self;
1354 let mut pa1 = pa1;
1355 pa1.do_not_free_on_drop();
1356 let pa1 = pa1.ptr;
1357 let mut pa2 = pa2;
1358 pa2.do_not_free_on_drop();
1359 let pa2 = pa2.ptr;
1360 let isl_rs_result = unsafe { isl_pw_aff_eq_map(pa1, pa2) };
1361 let isl_rs_result = Map { ptr: isl_rs_result,
1362 should_free_on_drop: true };
1363 isl_rs_result
1364 }
1365
1366 pub fn le_map(self, pa2: PwAff) -> Map {
1368 let pa1 = self;
1369 let mut pa1 = pa1;
1370 pa1.do_not_free_on_drop();
1371 let pa1 = pa1.ptr;
1372 let mut pa2 = pa2;
1373 pa2.do_not_free_on_drop();
1374 let pa2 = pa2.ptr;
1375 let isl_rs_result = unsafe { isl_pw_aff_le_map(pa1, pa2) };
1376 let isl_rs_result = Map { ptr: isl_rs_result,
1377 should_free_on_drop: true };
1378 isl_rs_result
1379 }
1380
1381 pub fn lt_map(self, pa2: PwAff) -> Map {
1383 let pa1 = self;
1384 let mut pa1 = pa1;
1385 pa1.do_not_free_on_drop();
1386 let pa1 = pa1.ptr;
1387 let mut pa2 = pa2;
1388 pa2.do_not_free_on_drop();
1389 let pa2 = pa2.ptr;
1390 let isl_rs_result = unsafe { isl_pw_aff_lt_map(pa1, pa2) };
1391 let isl_rs_result = Map { ptr: isl_rs_result,
1392 should_free_on_drop: true };
1393 isl_rs_result
1394 }
1395
1396 pub fn ge_map(self, pa2: PwAff) -> Map {
1398 let pa1 = self;
1399 let mut pa1 = pa1;
1400 pa1.do_not_free_on_drop();
1401 let pa1 = pa1.ptr;
1402 let mut pa2 = pa2;
1403 pa2.do_not_free_on_drop();
1404 let pa2 = pa2.ptr;
1405 let isl_rs_result = unsafe { isl_pw_aff_ge_map(pa1, pa2) };
1406 let isl_rs_result = Map { ptr: isl_rs_result,
1407 should_free_on_drop: true };
1408 isl_rs_result
1409 }
1410
1411 pub fn gt_map(self, pa2: PwAff) -> Map {
1413 let pa1 = self;
1414 let mut pa1 = pa1;
1415 pa1.do_not_free_on_drop();
1416 let pa1 = pa1.ptr;
1417 let mut pa2 = pa2;
1418 pa2.do_not_free_on_drop();
1419 let pa2 = pa2.ptr;
1420 let isl_rs_result = unsafe { isl_pw_aff_gt_map(pa1, pa2) };
1421 let isl_rs_result = Map { ptr: isl_rs_result,
1422 should_free_on_drop: true };
1423 isl_rs_result
1424 }
1425
1426 pub fn bind_id(self, id: Id) -> Set {
1428 let pa = self;
1429 let mut pa = pa;
1430 pa.do_not_free_on_drop();
1431 let pa = pa.ptr;
1432 let mut id = id;
1433 id.do_not_free_on_drop();
1434 let id = id.ptr;
1435 let isl_rs_result = unsafe { isl_pw_aff_bind_id(pa, id) };
1436 let isl_rs_result = Set { ptr: isl_rs_result,
1437 should_free_on_drop: true };
1438 isl_rs_result
1439 }
1440
1441 pub fn read_from_str(ctx: &Context, str_: &str) -> PwAff {
1443 let ctx = ctx.ptr;
1444 let str_ = CString::new(str_).unwrap();
1445 let str_ = str_.as_ptr();
1446 let isl_rs_result = unsafe { isl_pw_aff_read_from_str(ctx, str_) };
1447 let isl_rs_result = PwAff { ptr: isl_rs_result,
1448 should_free_on_drop: true };
1449 isl_rs_result
1450 }
1451
1452 pub fn to_str(&self) -> &str {
1454 let pa = self;
1455 let pa = pa.ptr;
1456 let isl_rs_result = unsafe { isl_pw_aff_to_str(pa) };
1457 let isl_rs_result = unsafe { CStr::from_ptr(isl_rs_result) };
1458 let isl_rs_result = isl_rs_result.to_str().unwrap();
1459 isl_rs_result
1460 }
1461
1462 pub fn dump(&self) {
1464 let pwaff = self;
1465 let pwaff = pwaff.ptr;
1466 let isl_rs_result = unsafe { isl_pw_aff_dump(pwaff) };
1467 isl_rs_result
1468 }
1469
1470 pub fn do_not_free_on_drop(&mut self) {
1472 self.should_free_on_drop = false;
1473 }
1474}
1475
1476impl Drop for PwAff {
1477 fn drop(&mut self) {
1478 if self.should_free_on_drop {
1479 unsafe {
1480 isl_pw_aff_free(self.ptr);
1481 }
1482 }
1483 }
1484}