3 struct isl_vec *isl_vec_alloc(struct isl_ctx *ctx, unsigned size)
7 vec = isl_alloc_type(ctx, struct isl_vec);
11 vec->block = isl_blk_alloc(ctx, size);
12 if (isl_blk_is_error(vec->block))
19 vec->el = vec->block.data;
23 isl_blk_free(ctx, vec->block);
27 struct isl_vec *isl_vec_copy(struct isl_vec *vec)
36 struct isl_vec *isl_vec_dup(struct isl_vec *vec)
42 vec2 = isl_vec_alloc(vec->ctx, vec->size);
43 isl_seq_cpy(vec2->el, vec->el, vec->size);
47 struct isl_vec *isl_vec_cow(struct isl_vec *vec)
56 vec2 = isl_vec_dup(vec);
61 void isl_vec_free(struct isl_vec *vec)
69 isl_ctx_deref(vec->ctx);
70 isl_blk_free(vec->ctx, vec->block);
74 void isl_vec_dump(struct isl_vec *vec, FILE *out, int indent)
79 fprintf(out, "%*snull vec\n", indent, "");
83 fprintf(out, "%*s[", indent, "");
84 for (i = 0; i < vec->size; ++i) {
87 isl_int_print(out, vec->el[i], 0);
92 void isl_vec_lcm(struct isl_vec *vec, isl_int *lcm)
94 isl_seq_lcm(vec->block.data, vec->size, lcm);