From 2132b65a334a7a875da791bb971b79c103c55623 Mon Sep 17 00:00:00 2001 From: Jukka Ojanen Date: Tue, 13 Oct 2015 00:44:58 +0300 Subject: Fix MSVC error C2719 --- src/ffts_dd.h | 36 ++++++++++++++++++------------------ src/ffts_trig.c | 5 +++-- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/ffts_dd.h b/src/ffts_dd.h index e9402c6..f8bbee4 100644 --- a/src/ffts_dd.h +++ b/src/ffts_dd.h @@ -142,12 +142,12 @@ ffts_dd_split(double a) #if HAVE_SSE2 static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_add_dd2_unnormalized(const struct ffts_dd2_t a, - const struct ffts_dd2_t b); +ffts_dd2_add_dd2_unnormalized(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b); static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_mul_dd2_unnormalized(const struct ffts_dd2_t a, - const struct ffts_dd2_t b); +ffts_dd2_mul_dd2_unnormalized(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b); static FFTS_INLINE struct ffts_dd2_t ffts_dd2_split(__m128d a); @@ -162,23 +162,23 @@ ffts_dd2_add(__m128d a, __m128d b) } static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_add_dd2(const struct ffts_dd2_t a, - const struct ffts_dd2_t b) +ffts_dd2_add_dd2(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b) { struct ffts_dd2_t t1 = ffts_dd2_add_dd2_unnormalized(a, b); return ffts_dd2_add(t1.hi, t1.lo); } static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_add_dd2_unnormalized(const struct ffts_dd2_t a, - const struct ffts_dd2_t b) +ffts_dd2_add_dd2_unnormalized(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b) { struct ffts_dd2_t dd2; __m128d e1; - dd2.hi = _mm_add_pd(a.hi, b.hi); - e1 = _mm_sub_pd(dd2.hi, a.hi); - dd2.lo = _mm_add_pd(_mm_add_pd(_mm_sub_pd(a.hi, _mm_sub_pd(dd2.hi, e1)), - _mm_sub_pd(b.hi, e1)), _mm_add_pd(a.lo, b.lo)); + dd2.hi = _mm_add_pd(a->hi, b->hi); + e1 = _mm_sub_pd(dd2.hi, a->hi); + dd2.lo = _mm_add_pd(_mm_add_pd(_mm_sub_pd(a->hi, _mm_sub_pd(dd2.hi, e1)), + _mm_sub_pd(b->hi, e1)), _mm_add_pd(a->lo, b->lo)); return dd2; } @@ -198,20 +198,20 @@ ffts_dd2_mul(const __m128d a, const __m128d b) } static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_mul_dd2(const struct ffts_dd2_t a, - const struct ffts_dd2_t b) +ffts_dd2_mul_dd2(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b) { struct ffts_dd2_t dd2 = ffts_dd2_mul_dd2_unnormalized(a, b); return ffts_dd2_add(dd2.hi, dd2.lo); } static FFTS_INLINE struct ffts_dd2_t -ffts_dd2_mul_dd2_unnormalized(const struct ffts_dd2_t a, - const struct ffts_dd2_t b) +ffts_dd2_mul_dd2_unnormalized(const struct ffts_dd2_t *const FFTS_RESTRICT a, + const struct ffts_dd2_t *const FFTS_RESTRICT b) { - struct ffts_dd2_t dd2 = ffts_dd2_mul(a.hi, b.hi); + struct ffts_dd2_t dd2 = ffts_dd2_mul(a->hi, b->hi); dd2.lo = _mm_add_pd(dd2.lo, _mm_add_pd( - _mm_mul_pd(a.hi, b.lo), _mm_mul_pd(a.lo, b.hi))); + _mm_mul_pd(a->hi, b->lo), _mm_mul_pd(a->lo, b->hi))); return dd2; } diff --git a/src/ffts_trig.c b/src/ffts_trig.c index cdd2d05..74ebfd2 100644 --- a/src/ffts_trig.c +++ b/src/ffts_trig.c @@ -300,6 +300,7 @@ ffts_generate_cosine_sine_pow2_64f(ffts_cpx_64f *const table, int table_size) const double *FFTS_RESTRICT hs; struct ffts_dd2_t FFTS_ALIGN(16) w[32]; struct ffts_dd2_t FFTS_ALIGN(16) h[32]; + struct ffts_dd2_t FFTS_ALIGN(16) sum; int i, log_2, offset; /* size must be a power of two */ @@ -352,8 +353,8 @@ ffts_generate_cosine_sine_pow2_64f(ffts_cpx_64f *const table, int table_size) /* skip and find next trailing zero */ offset = (log_2 + 2 + ffts_ctzl(~i >> (log_2 + 2))); - w[log_2] = ffts_dd2_mul_dd2(h[log_2], - ffts_dd2_add_dd2_unnormalized(w[log_2 + 1], w[offset])); + sum = ffts_dd2_add_dd2_unnormalized(&w[log_2 + 1], &w[offset]); + w[log_2] = ffts_dd2_mul_dd2(&h[log_2], &sum); } mid_point: -- cgit v1.1