@@ -133,29 +133,22 @@ namespace detail {
133133 }
134134}
135135
136+ #ifdef AMREX_USE_SIMD
136137// ! Return sine and cosine of given number
137- template <typename T_Real
138- #ifndef AMREX_USE_SIMD
139- , std::enable_if_t <std::is_floating_point_v<T_Real>,int > = 0
140- #endif
141- >
138+ template <typename T_Real,
139+ std::enable_if_t <amrex::simd::stdx::is_simd_v<T_Real>,int > = 0 >
142140AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
143141std::pair<T_Real,T_Real> sincos (T_Real x)
144142{
145- #ifdef AMREX_USE_SIMD
146143 using namespace amrex ::simd::stdx;
147- #else
148- using namespace std ;
149- #endif
150-
151144 std::pair<T_Real,T_Real> r;
152145 r.first = sin (x);
153146 r.second = cos (x);
154147 return r;
155148}
149+ #endif
156150
157151// ! Return sine and cosine of given number
158- template <>
159152AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
160153std::pair<double ,double > sincos (double x)
161154{
@@ -170,7 +163,6 @@ std::pair<double,double> sincos (double x)
170163}
171164
172165// ! Return sine and cosine of given number
173- template <>
174166AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
175167std::pair<float ,float > sincos (float x)
176168{
@@ -184,30 +176,23 @@ std::pair<float,float> sincos (float x)
184176 return r;
185177}
186178
179+ #ifdef AMREX_USE_SIMD
187180// ! Return sin(pi*x) and cos(pi*x) given x
188- template <typename T_Real
189- #ifndef AMREX_USE_SIMD
190- , std::enable_if_t <std::is_floating_point_v<T_Real>,int > = 0
191- #endif
192- >
181+ template <typename T_Real,
182+ std::enable_if_t <amrex::simd::stdx::is_simd_v<T_Real>,int > = 0 >
193183AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
194184std::pair<T_Real,T_Real> sincospi (T_Real x)
195185{
196- #ifdef AMREX_USE_SIMD
197186 using namespace amrex ::simd::stdx;
198- #else
199- using namespace std ;
200- #endif
201-
202- T_Real const px = pi<T_Real>() * x;
187+ T_Real const px = pi<typename T_Real::value_type>() * x;
203188 std::pair<T_Real,T_Real> r;
204189 r.first = sin (px);
205190 r.second = cos (px);
206191 return r;
207192}
193+ #endif
208194
209195// ! Return sin(pi*x) and cos(pi*x) given x
210- template <>
211196AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
212197std::pair<double ,double > sincospi (double x)
213198{
@@ -222,7 +207,6 @@ std::pair<double,double> sincospi (double x)
222207}
223208
224209// ! Return sin(pi*x) and cos(pi*x) given x
225- template <>
226210AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
227211std::pair<float ,float > sincospi (float x)
228212{
0 commit comments