Skip to content

Commit

Permalink
switch from memcpy() to std::copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
mreineck committed Feb 8, 2021
1 parent 5faa2bd commit 1d6ff70
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions pocketfft_hdronly.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
This file is part of pocketfft.
Copyright (C) 2010-2020 Max-Planck-Society
Copyright (C) 2010-2021 Max-Planck-Society
Copyright (C) 2019-2020 Peter Bell
For the odd-sized DCT-IV transforms:
Expand Down Expand Up @@ -52,12 +52,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif

#include <cmath>
#include <cstring>
#include <cstdlib>
#include <stdexcept>
#include <memory>
#include <vector>
#include <complex>
#include <algorithm>
#if POCKETFFT_CACHE_SIZE!=0
#include <array>
#include <mutex>
Expand Down Expand Up @@ -1456,7 +1456,7 @@ template<bool fwd, typename T> void pass_all(T c[], T0 fct) const
for (size_t i=0; i<length; ++i)
c[i] = ch[i]*fct;
else
memcpy (c,p1,length*sizeof(T));
std::copy (p1, p1+length, c);
}
else
if (fct!=1.)
Expand Down Expand Up @@ -2212,7 +2212,7 @@ template<typename T> void radbg(size_t ido, size_t ip, size_t l1,
for (size_t i=0; i<n; ++i)
c[i] = fct*p1[i];
else
memcpy (c,p1,n*sizeof(T));
std::copy (p1, p1+length, c);
}
else
if (fct!=1.)
Expand Down Expand Up @@ -2437,13 +2437,12 @@ template<typename T0> class fftblue
tmp[m].Set(c[m], zero);
fft<true>(tmp.data(),fct);
c[0] = tmp[0].r;
memcpy (c+1, tmp.data()+1, (n-1)*sizeof(T));
std::copy (&tmp[1].r, &tmp[1].r+n-1, &c[1], tmp.data()+1);
}
else
{
tmp[0].Set(c[0],c[0]*0);
memcpy (reinterpret_cast<void *>(tmp.data()+1),
reinterpret_cast<void *>(c+1), (n-1)*sizeof(T));
std::copy (c+1, c+n, &tmp[1].r);
if ((n&1)==0) tmp[n/2].i=T0(0)*c[0];
for (size_t m=1; 2*m<n; ++m)
tmp[n-m].Set(tmp[m].r, -tmp[m].i);
Expand Down

0 comments on commit 1d6ff70

Please sign in to comment.