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))
20 isl_blk_free(ctx, vec->block);
24 struct isl_vec *isl_vec_copy(struct isl_ctx *ctx, struct isl_vec *vec)
33 struct isl_vec *isl_vec_dup(struct isl_ctx *ctx, struct isl_vec *vec)
39 vec2 = isl_vec_alloc(ctx, vec->size);
40 isl_seq_cpy(vec2->block.data, vec->block.data, vec->size);
44 struct isl_vec *isl_vec_cow(struct isl_ctx *ctx, struct isl_vec *vec)
53 vec2 = isl_vec_dup(ctx, vec);
54 isl_vec_free(ctx, vec);
58 void isl_vec_free(struct isl_ctx *ctx, struct isl_vec *vec)
66 isl_blk_free(ctx, vec->block);
70 void isl_vec_dump(struct isl_ctx *ctx, struct isl_vec *vec,
71 FILE *out, int indent)
76 fprintf(out, "%*snull vec\n", indent, "");
80 fprintf(out, "%*s[", indent, "");
81 for (i = 0; i < vec->size; ++i) {
84 isl_int_print(out, vec->block.data[i], 0);
89 void isl_vec_lcm(struct isl_ctx *ctx, struct isl_vec *vec, isl_int *lcm)
91 isl_seq_lcm(vec->block.data, vec->size, lcm);