~ubuntu-branches/ubuntu/raring/fftw3/raring-proposed

« back to all changes in this revision

Viewing changes to kernel/cpy1d.c

  • Committer: Bazaar Package Importer
  • Author(s): Paul Brossier
  • Date: 2006-05-31 13:44:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060531134405-ol9hrbg6bh81sg0c
Tags: 3.1.1-1
* New upstream release (closes: #350327, #338487, #338501)
* Add --enable-portable-binary to use -mtune instead of -march
* Use --with-gcc-arch=G5 / pentium4 on powerpc / i386
* Updated Standards-Version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2003, 2006 Matteo Frigo
 
3
 * Copyright (c) 2003, 2006 Massachusetts Institute of Technology
 
4
 *
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 *
 
19
 */
 
20
 
 
21
/* out of place 1D copy routine */
 
22
#include "ifftw.h"
 
23
 
 
24
void X(cpy1d)(R *I, R *O, INT n0, INT is0, INT os0, INT vl)
 
25
{
 
26
     INT i0, v;
 
27
 
 
28
     A(I != O);
 
29
     switch (vl) {
 
30
         case 1:
 
31
              if ((n0 & 1) || is0 != 1 || os0 != 1) {
 
32
                   for (; n0 > 0; --n0, I += is0, O += os0)
 
33
                        *O = *I;
 
34
                   break;
 
35
              }
 
36
              n0 /= 2; is0 = 2; os0 = 2;
 
37
              /* fall through */
 
38
         case 2:
 
39
              if ((n0 & 1) || is0 != 2 || os0 != 2) {
 
40
                   for (; n0 > 0; --n0, I += is0, O += os0) {
 
41
                        R x0 = I[0];
 
42
                        R x1 = I[1];
 
43
                        O[0] = x0;
 
44
                        O[1] = x1;
 
45
                   }
 
46
                   break;
 
47
              }
 
48
              n0 /= 2; is0 = 4; os0 = 4;
 
49
              /* fall through */
 
50
         case 4:
 
51
              for (; n0 > 0; --n0, I += is0, O += os0) {
 
52
                   R x0 = I[0];
 
53
                   R x1 = I[1];
 
54
                   R x2 = I[2];
 
55
                   R x3 = I[3];
 
56
                   O[0] = x0;
 
57
                   O[1] = x1;
 
58
                   O[2] = x2;
 
59
                   O[3] = x3;
 
60
              }
 
61
              break;
 
62
         default:
 
63
              for (i0 = 0; i0 < n0; ++i0)
 
64
                   for (v = 0; v < vl; ++v) {
 
65
                        R x0 = I[i0 * is0 + v];
 
66
                        O[i0 * os0 + v] = x0;
 
67
                   }
 
68
              break;
 
69
     }
 
70
}