Commit d250df55 authored by Martin Reinecke's avatar Martin Reinecke

avoid more clang warnings, and hopefully stay compatible with MSVC

parent 1a1f6477
......@@ -713,12 +713,10 @@ template<bool fwd, typename T> void pass2 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=2;
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+2*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -762,14 +760,13 @@ template<bool fwd, typename T> void pass3 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=3;
constexpr T0 tw1r=-0.5,
tw1i= (fwd ? -1: 1) * T0(0.8660254037844386467637231707529362L);
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+3*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -802,12 +799,10 @@ template<bool fwd, typename T> void pass4 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=4;
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+4*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -878,7 +873,6 @@ template<bool fwd, typename T> void pass5 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=5;
constexpr T0 tw1r= T0(0.3090169943749474241022934171828191L),
tw1i= (fwd ? -1: 1) * T0(0.9510565162951535721164393333793821L),
tw2r= T0(-0.8090169943749474241022934171828191L),
......@@ -886,8 +880,8 @@ template<bool fwd, typename T> void pass5 (size_t ido, size_t l1,
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+5*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -950,7 +944,6 @@ template<bool fwd, typename T> void pass7(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=7;
constexpr T0 tw1r= T0(0.6234898018587335305250048840042398L),
tw1i= (fwd ? -1 : 1) * T0(0.7818314824680298087084445266740578L),
tw2r= T0(-0.2225209339563144042889025644967948L),
......@@ -960,8 +953,8 @@ template<bool fwd, typename T> void pass7(size_t ido, size_t l1,
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+7*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -1018,12 +1011,10 @@ template<bool fwd, typename T> void pass8 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=8;
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+8*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -1133,7 +1124,6 @@ template<bool fwd, typename T> void pass11 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const cmplx<T0> * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=11;
constexpr T0 tw1r= T0(0.8412535328311811688618116489193677L),
tw1i= (fwd ? -1 : 1) * T0(0.5406408174555975821076359543186917L),
tw2r= T0(0.4154150130018864255292741492296232L),
......@@ -1147,8 +1137,8 @@ template<bool fwd, typename T> void pass11 (size_t ido, size_t l1,
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+11*c)]; };
auto WA = [wa, ido](size_t x, size_t i)
{ return wa[i-1+x*(ido-1)]; };
......@@ -1454,13 +1444,11 @@ template<typename T> void radf2 (size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=2;
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,l1](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+l1*c)]; };
auto CH = [ch,ido,cdim](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+cdim*c)]; };
auto CH = [ch,ido](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+2*c)]; };
for (size_t k=0; k<l1; k++)
PM (CH(0,0,k),CH(ido-1,1,k),CC(0,k,0),CC(0,k,1));
......@@ -1493,14 +1481,13 @@ template<typename T> void radf3(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=3;
constexpr T0 taur=-0.5, taui=T0(0.8660254037844386467637231707529362L);
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,l1](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+l1*c)]; };
auto CH = [ch,ido,cdim](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+cdim*c)]; };
auto CH = [ch,ido](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+3*c)]; };
for (size_t k=0; k<l1; k++)
{
......@@ -1533,14 +1520,13 @@ template<typename T> void radf4(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=4;
constexpr T0 hsqt2=T0(0.707106781186547524400844362104849L);
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,l1](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+l1*c)]; };
auto CH = [ch,ido,cdim](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+cdim*c)]; };
auto CH = [ch,ido](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+4*c)]; };
for (size_t k=0; k<l1; k++)
{
......@@ -1581,7 +1567,6 @@ template<typename T> void radf5(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=5;
constexpr T0 tr11= T0(0.3090169943749474241022934171828191L),
ti11= T0(0.9510565162951535721164393333793821L),
tr12= T0(-0.8090169943749474241022934171828191L),
......@@ -1590,8 +1575,8 @@ template<typename T> void radf5(size_t ido, size_t l1,
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,l1](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+l1*c)]; };
auto CH = [ch,ido,cdim](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+cdim*c)]; };
auto CH = [ch,ido](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+5*c)]; };
for (size_t k=0; k<l1; k++)
{
......@@ -1780,11 +1765,9 @@ template<typename T> void radb2(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=2;
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+2*c)]; };
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
......@@ -1812,12 +1795,11 @@ template<typename T> void radb3(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=3;
constexpr T0 taur=-0.5, taui=T0(0.8660254037844386467637231707529362L);
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+3*c)]; };
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
......@@ -1853,12 +1835,11 @@ template<typename T> void radb4(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=4;
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+4*c)]; };
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
......@@ -1906,15 +1887,14 @@ template<typename T> void radb5(size_t ido, size_t l1,
const T * POCKETFFT_RESTRICT cc, T * POCKETFFT_RESTRICT ch,
const T0 * POCKETFFT_RESTRICT wa) const
{
constexpr size_t cdim=5;
constexpr T0 tr11= T0(0.3090169943749474241022934171828191L),
ti11= T0(0.9510565162951535721164393333793821L),
tr12= T0(-0.8090169943749474241022934171828191L),
ti12= T0(0.5877852522924731291687059546390728L);
auto WA = [wa,ido](size_t x, size_t i) { return wa[i+x*(ido-1)]; };
auto CC = [cc,ido,cdim](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+cdim*c)]; };
auto CC = [cc,ido](size_t a, size_t b, size_t c) -> const T&
{ return cc[a+ido*(b+5*c)]; };
auto CH = [ch,ido,l1](size_t a, size_t b, size_t c) -> T&
{ return ch[a+ido*(b+l1*c)]; };
......@@ -2578,7 +2558,6 @@ template<typename T0> class T_dcst4
template<typename T> POCKETFFT_NOINLINE void exec(T c[], T0 fct,
bool /*ortho*/, int /*type*/, bool cosine) const
{
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
size_t n2 = N/2;
if (!cosine)
for (size_t k=0, kc=N-1; k<n2; ++k, --kc)
......@@ -2605,7 +2584,11 @@ template<typename T0> class T_dcst4
}
rfft->exec(y.data(), fct, true);
{
auto SGN = [sqrt2](size_t i) {return (i&2) ? -sqrt2 : sqrt2;};
auto SGN = [](size_t i)
{
constexpr T0 sqrt2=T0(1.414213562373095048801688724209698L);
return (i&2) ? -sqrt2 : sqrt2;
};
c[n2] = y[0]*SGN(n2+1);
size_t i=0, i1=1, k=1;
for (; k<n2; ++i, ++i1, k+=2)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment