summaryrefslogtreecommitdiff
path: root/transfer_interp_template.c
diff options
context:
space:
mode:
Diffstat (limited to 'transfer_interp_template.c')
-rw-r--r--transfer_interp_template.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/transfer_interp_template.c b/transfer_interp_template.c
index 65ae98b..f97f816 100644
--- a/transfer_interp_template.c
+++ b/transfer_interp_template.c
@@ -22,14 +22,23 @@
# define CONT generic
#endif
-#define JOIN3(a, b, c) a ## _ ## b ## _ ## c
-#define FUNC2(name, cont, stencil) JOIN3(name, cont, stencil)
-#define FUNC(name) FUNC2(name, CONT, STENCIL)
+#if ADD
+# define ACT add
+#else
+# define ACT store
+#endif
+
+#define JOIN4(a, b, c, d) a ## _ ## b ## _ ## c ## _ ## d
+#define FUNC2(name, act, cont, stencil) JOIN4(name, act, cont, stencil)
+#define FUNC(name) FUNC2(name, ACT, CONT, STENCIL)
static void
FUNC(interp_transfer_line)(double *dst, ptrdiff_t dst_len,
const double *src, ptrdiff_t src_stride,
const ptrdiff_t *idx_x, const double *fact_x, const double *fact_y
+#if ADD
+ , double fact
+#endif
#if !CONTIGUOUS
, ptrdiff_t dst_stride0, ptrdiff_t src_stride0
# define SSTRIDE1 src_stride0
@@ -52,13 +61,18 @@ FUNC(interp_transfer_line)(double *dst, ptrdiff_t dst_len,
val += tmp * fact_y[idx0];
}
+#if ADD
+ dst[x * DSTRIDE1] += fact * val;
+#else
dst[x * DSTRIDE1] = val;
+#endif
}
}
#undef SSTRIDE1
#undef DSTRIDE1
#undef CONT
-#undef JOIN3
+#undef ACT
+#undef JOIN4
#undef FUNC2
#undef FUNC