/src/fftw3/kernel/cpy1d.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2003, 2007-14 Matteo Frigo |
3 | | * Copyright (c) 2003, 2007-14 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
18 | | * |
19 | | */ |
20 | | |
21 | | /* out of place 1D copy routine */ |
22 | | #include "kernel/ifftw.h" |
23 | | |
24 | | void X(cpy1d)(R *I, R *O, INT n0, INT is0, INT os0, INT vl) |
25 | 73 | { |
26 | 73 | INT i0, v; |
27 | | |
28 | 73 | A(I != O); |
29 | 73 | switch (vl) { |
30 | 11 | case 1: |
31 | 11 | if ((n0 & 1) || is0 != 1 || os0 != 1) { |
32 | 0 | for (; n0 > 0; --n0, I += is0, O += os0) |
33 | 0 | *O = *I; |
34 | 0 | break; |
35 | 0 | } |
36 | 11 | n0 /= 2; is0 = 2; os0 = 2; |
37 | | /* fall through */ |
38 | 11 | case 2: |
39 | 11 | if ((n0 & 1) || is0 != 2 || os0 != 2) { |
40 | 22 | for (; n0 > 0; --n0, I += is0, O += os0) { |
41 | 11 | R x0 = I[0]; |
42 | 11 | R x1 = I[1]; |
43 | 11 | O[0] = x0; |
44 | 11 | O[1] = x1; |
45 | 11 | } |
46 | 11 | break; |
47 | 11 | } |
48 | 0 | n0 /= 2; is0 = 4; os0 = 4; |
49 | | /* fall through */ |
50 | 0 | case 4: |
51 | 0 | for (; n0 > 0; --n0, I += is0, O += os0) { |
52 | 0 | R x0 = I[0]; |
53 | 0 | R x1 = I[1]; |
54 | 0 | R x2 = I[2]; |
55 | 0 | R x3 = I[3]; |
56 | 0 | O[0] = x0; |
57 | 0 | O[1] = x1; |
58 | 0 | O[2] = x2; |
59 | 0 | O[3] = x3; |
60 | 0 | } |
61 | 0 | break; |
62 | 62 | default: |
63 | 1.16k | for (i0 = 0; i0 < n0; ++i0) |
64 | 40.9k | for (v = 0; v < vl; ++v) { |
65 | 39.8k | R x0 = I[i0 * is0 + v]; |
66 | 39.8k | O[i0 * os0 + v] = x0; |
67 | 39.8k | } |
68 | 62 | break; |
69 | 73 | } |
70 | 73 | } |