Coverage Report

Created: 2024-09-08 06:43

/src/fftw3/kernel/tile2d.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 2D copy routines */
22
#include "kernel/ifftw.h"
23
24
void X(tile2d)(INT n0l, INT n0u, INT n1l, INT n1u, INT tilesz,
25
         void (*f)(INT n0l, INT n0u, INT n1l, INT n1u, void *args),
26
         void *args)
27
0
{
28
0
     INT d0, d1;
29
30
0
     A(tilesz > 0); /* infinite loops otherwise */
31
     
32
0
 tail:
33
0
     d0 = n0u - n0l;
34
0
     d1 = n1u - n1l;
35
36
0
     if (d0 >= d1 && d0 > tilesz) {
37
0
    INT n0m = (n0u + n0l) / 2;
38
0
    X(tile2d)(n0l, n0m, n1l, n1u, tilesz, f, args);
39
0
    n0l = n0m; goto tail;
40
0
     } else if (/* d1 >= d0 && */ d1 > tilesz) {
41
0
    INT n1m = (n1u + n1l) / 2;
42
0
    X(tile2d)(n0l, n0u, n1l, n1m, tilesz, f, args);
43
0
    n1l = n1m; goto tail;
44
0
     } else {
45
0
    f(n0l, n0u, n1l, n1u, args);
46
0
     }
47
0
}
48
49
INT X(compute_tilesz)(INT vl, int how_many_tiles_in_cache)
50
113
{
51
113
     return X(isqrt)(CACHESIZE / 
52
113
         (((INT)sizeof(R)) * vl * (INT)how_many_tiles_in_cache));
53
113
}