From 9d57b598b8b3f79bafc27f76a0d7762a12af4869 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 21 Mar 2011 12:59:18 +0100 Subject: [PATCH] add isl_dim_map_range Signed-off-by: Sven Verdoolaege --- isl_dim_map.c | 20 +++++++++++++++++++- isl_dim_map.h | 4 ++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/isl_dim_map.c b/isl_dim_map.c index 20dca99..bf4491f 100644 --- a/isl_dim_map.c +++ b/isl_dim_map.c @@ -1,6 +1,6 @@ /* * Copyright 2008-2009 Katholieke Universiteit Leuven - * Copyright 2010 INRIA Saclay + * Copyright 2010-2011 INRIA Saclay * * Use of this software is governed by the GNU LGPLv2.1 license * @@ -42,6 +42,24 @@ __isl_give isl_dim_map *isl_dim_map_alloc(isl_ctx *ctx, unsigned len) return dim_map; } +void isl_dim_map_range(__isl_keep isl_dim_map *dim_map, + unsigned dst_pos, unsigned dst_stride, + unsigned src_pos, unsigned src_stride, + unsigned n, int sign) +{ + int i; + + if (!dim_map) + return; + + for (i = 0; i < n; ++i) { + unsigned d = 1 + dst_pos + dst_stride * i; + unsigned s = 1 + src_pos + src_stride * i; + dim_map->m[d].pos = s; + dim_map->m[d].sgn = sign; + } +} + void isl_dim_map_dim_range(__isl_keep isl_dim_map *dim_map, struct isl_dim *dim, enum isl_dim_type type, unsigned first, unsigned n, unsigned dst_pos) diff --git a/isl_dim_map.h b/isl_dim_map.h index 943b521..754e5b1 100644 --- a/isl_dim_map.h +++ b/isl_dim_map.h @@ -9,6 +9,10 @@ struct isl_dim_map; typedef struct isl_dim_map isl_dim_map; __isl_give isl_dim_map *isl_dim_map_alloc(isl_ctx *ctx, unsigned len); +void isl_dim_map_range(__isl_keep isl_dim_map *dim_map, + unsigned dst_pos, unsigned dst_stride, + unsigned src_pos, unsigned src_stride, + unsigned n, int sign); void isl_dim_map_dim_range(__isl_keep isl_dim_map *dim_map, struct isl_dim *dim, enum isl_dim_type type, unsigned first, unsigned n, unsigned dst_pos); -- 2.7.4