Skip to content

Commit

Permalink
Major 64-bit cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
matteo-frigo committed Dec 18, 2005
1 parent 3cd29a6 commit e99c678
Show file tree
Hide file tree
Showing 104 changed files with 1,047 additions and 1,052 deletions.
29 changes: 15 additions & 14 deletions dft/bluestein.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ typedef struct {

typedef struct {
plan_dft super;
int n; /* problem size */
int nb; /* size of convolution */
INT n; /* problem size */
INT nb; /* size of convolution */
R *w; /* lambda k . exp(2*pi*i*k^2/(2*n)) */
R *W; /* DFT(w) */
plan *cldf;
int is, os;
INT is, os;
} P;

static void bluestein_sequence(int n, R *w)
static void bluestein_sequence(INT n, R *w)
{
int k, ksq, n2 = 2 * n;
INT k, ksq, n2 = 2 * n;

ksq = 0;
for (k = 0; k < n; ++k) {
Expand All @@ -49,17 +49,18 @@ static void bluestein_sequence(int n, R *w)

static void mktwiddle(P *p)
{
int i;
int n = p->n, nb = p->nb;
INT i;
INT n = p->n, nb = p->nb;
R *w, *W;
E nbf = nb;
E nbf = (E)nb;

p->w = w = (R *) MALLOC(2 * n * sizeof(R), TWIDDLES);
p->W = W = (R *) MALLOC(2 * nb * sizeof(R), TWIDDLES);

bluestein_sequence(n, w);

for (i = 0; i < nb; ++i)
W[2*i] = W[2*i+1] = 0;
W[2*i] = W[2*i+1] = 0.0;

W[0] = w[0] / nbf;
W[1] = w[1] / nbf;
Expand All @@ -79,7 +80,7 @@ static void mktwiddle(P *p)
static void apply(const plan *ego_, R *ri, R *ii, R *ro, R *io)
{
const P *ego = (const P *) ego_;
int i, n = ego->n, nb = ego->nb, is = ego->is, os = ego->os;
INT i, n = ego->n, nb = ego->nb, is = ego->is, os = ego->os;
R *w = ego->w, *W = ego->W;
R *b = (R *) MALLOC(2 * nb * sizeof(R), BUFFERS);

Expand All @@ -91,7 +92,7 @@ static void apply(const plan *ego_, R *ri, R *ii, R *ro, R *io)
b[2*i+1] = xi * wr - xr * wi;
}

for (; i < nb; ++i) b[2*i] = b[2*i+1] = 0;
for (; i < nb; ++i) b[2*i] = b[2*i+1] = 0.0;

/* convolution: FFT */
{
Expand Down Expand Up @@ -179,9 +180,9 @@ static void print(const plan *ego_, printer *p)
ego->n, ego->nb, ego->cldf);
}

static int choose_transform_size(int minsz)
static INT choose_transform_size(INT minsz)
{
static const int primes[] = { 2, 3, 5, 0 };
static const INT primes[] = { 2, 3, 5, 0 };
while (!X(factors_into)(minsz, primes))
++minsz;
return minsz;
Expand All @@ -191,7 +192,7 @@ static plan *mkplan(const solver *ego, const problem *p_, planner *plnr)
{
const problem_dft *p = (const problem_dft *) p_;
P *pln;
int n, nb;
INT n, nb;
plan *cldf = 0;
R *buf = (R *) 0;

Expand Down
40 changes: 20 additions & 20 deletions dft/buffered.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
*
*/

/* $Id: buffered.c,v 1.53 2005-04-10 20:33:24 athena Exp $ */
/* $Id: buffered.c,v 1.54 2005-12-18 01:28:50 athena Exp $ */

#include "dft.h"

typedef struct {
int nbuf;
int maxbufsz;
int skew_alignment;
int skew;
INT nbuf;
INT maxbufsz;
INT skew_alignment;
INT skew;
const char *nam;
} bufadt;

Expand All @@ -39,9 +39,9 @@ typedef struct {
plan_dft super;

plan *cld, *cldcpy, *cldrest;
int n, vl, nbuf, bufdist;
int ivs, ovs;
int roffset, ioffset;
INT n, vl, nbuf, bufdist;
INT ivs, ovs;
INT roffset, ioffset;

const S *slv;
} P;
Expand All @@ -50,15 +50,15 @@ typedef struct {
static void apply(const plan *ego_, R *ri, R *ii, R *ro, R *io)
{
const P *ego = (const P *) ego_;
int nbuf = ego->nbuf;
INT nbuf = ego->nbuf;
R *bufs = (R *)MALLOC(sizeof(R) * nbuf * ego->bufdist * 2, BUFFERS);

plan_dft *cld = (plan_dft *) ego->cld;
plan_dft *cldcpy = (plan_dft *) ego->cldcpy;
plan_dft *cldrest;
int i, vl = ego->vl;
int ivs = ego->ivs, ovs = ego->ovs;
int roffset = ego->roffset, ioffset = ego->ioffset;
INT i, vl = ego->vl;
INT ivs = ego->ivs, ovs = ego->ovs;
INT roffset = ego->roffset, ioffset = ego->ioffset;

for (i = nbuf; i <= vl; i += nbuf) {
/* transform to bufs: */
Expand Down Expand Up @@ -105,12 +105,12 @@ static void print(const plan *ego_, printer *p)
ego->cld, ego->cldcpy, ego->cldrest);
}

static int compute_nbuf(int n, int vl, const S *ego)
static INT compute_nbuf(INT n, INT vl, const S *ego)
{
return X(compute_nbuf)(n, vl, ego->adt->nbuf, ego->adt->maxbufsz);
}

static int toobig(int n, const S *ego)
static int toobig(INT n, const S *ego)
{
return (n > ego->adt->maxbufsz);
}
Expand Down Expand Up @@ -178,8 +178,8 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
plan *cldrest = (plan *) 0;
const problem_dft *p = (const problem_dft *) p_;
R *bufs = (R *) 0;
int nbuf = 0, bufdist, n, vl;
int ivs, ovs, roffset, ioffset;
INT nbuf = 0, bufdist, n, vl;
INT ivs, ovs, roffset, ioffset;

static const plan_adt padt = {
X(dft_solve), awake, print, destroy
Expand Down Expand Up @@ -211,7 +211,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

/* attempt to keep real and imaginary part in the same order,
so as to allow optimizations in the the copy plan */
roffset = (p->ri - p->ii > 0) ? 1 : 0;
roffset = (p->ri - p->ii > 0) ? (INT)1 : (INT)0;
ioffset = 1 - roffset;

/* initial allocation for the purpose of planning */
Expand Down Expand Up @@ -249,8 +249,8 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)

/* plan the leftover transforms (cldrest): */
{
int id = ivs * (nbuf * (vl / nbuf));
int od = ovs * (nbuf * (vl / nbuf));
INT id = ivs * (nbuf * (vl / nbuf));
INT od = ovs * (nbuf * (vl / nbuf));
cldrest = X(mkplan_d)(plnr,
X(mkproblem_dft_d)(
X(tensor_copy)(p->sz),
Expand Down Expand Up @@ -305,7 +305,7 @@ void X(dft_buffered_register)(planner *p)
/* FIXME: what are good defaults? */
static const bufadt adt = {
/* nbuf */ 8,
/* maxbufsz */ (65536 / sizeof(R)),
/* maxbufsz */ (INT)(65536 / sizeof(R)),
/* skew_alignment */ 8,
#if HAVE_SIMD /* 5 is odd and screws up the alignment. */
/* skew */ 6,
Expand Down
34 changes: 17 additions & 17 deletions dft/codelet-dft.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
*/

/* $Id: codelet-dft.h,v 1.6 2005-02-14 17:08:52 athena Exp $ */
/* $Id: codelet-dft.h,v 1.7 2005-12-18 01:28:50 athena Exp $ */

/*
* This header file must include every file or define every
Expand All @@ -41,24 +41,24 @@ typedef struct {
int (*okp)(
const kdft_desc *desc,
const R *ri, const R *ii, const R *ro, const R *io,
int is, int os, int vl, int ivs, int ovs,
INT is, INT os, INT vl, INT ivs, INT ovs,
const planner *plnr);
int vl;
INT vl;
} kdft_genus;

struct kdft_desc_s {
int sz; /* size of transform computed */
INT sz; /* size of transform computed */
const char *nam;
opcnt ops;
const kdft_genus *genus;
int is;
int os;
int ivs;
int ovs;
INT is;
INT os;
INT ivs;
INT ovs;
};

typedef void (*kdft) (const R *ri, const R *ii, R *ro, R *io,
stride is, stride os, int vl, int ivs, int ovs);
stride is, stride os, INT vl, INT ivs, INT ovs);
void X(kdft_register)(planner *p, kdft codelet, const kdft_desc *desc);


Expand All @@ -67,31 +67,31 @@ typedef struct ct_desc_s ct_desc;
typedef struct {
int (*okp)(
const struct ct_desc_s *desc,
const R *rio, const R *iio, int ios, int vs, int m, int dist,
const R *rio, const R *iio, INT ios, INT vs, INT m, INT dist,
const planner *plnr);
int vl;
INT vl;
} ct_genus;

struct ct_desc_s {
int radix;
INT radix;
const char *nam;
const tw_instr *tw;
opcnt ops;
const ct_genus *genus;
int s1;
int s2;
int dist;
INT s1;
INT s2;
INT dist;
};

typedef const R *(*kdftw) (R *rioarray, R *iioarray, const R *W,
stride ios, int m, int dist);
stride ios, INT m, INT dist);
void X(kdft_dit_register)(planner *p, kdftw codelet, const ct_desc *desc);
void X(kdft_dif_register)(planner *p, kdftw codelet, const ct_desc *desc);


typedef const R *(*kdftwsq) (R *rioarray, R *iioarray,
const R *W, stride is, stride vs,
int m, int dist);
INT m, INT dist);
void X(kdft_difsq_register)(planner *p, kdftwsq codelet, const ct_desc *desc);


Expand Down
2 changes: 1 addition & 1 deletion dft/codelets/n.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
static int okp(const kdft_desc *d,
const R *ri, const R *ii,
const R *ro, const R *io,
int is, int os, int vl, int ivs, int ovs,
INT is, INT os, INT vl, INT ivs, INT ovs,
const planner *plnr)
{
UNUSED(ri); UNUSED(ii); UNUSED(ro); UNUSED(io); UNUSED(vl); UNUSED(plnr);
Expand Down
2 changes: 1 addition & 1 deletion dft/codelets/t.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

static int okp(const ct_desc *d,
const R *rio, const R *iio,
int ios, int vs, int m, int dist, const planner *plnr)
INT ios, INT vs, INT m, INT dist, const planner *plnr)
{
UNUSED(rio); UNUSED(iio); UNUSED(m); UNUSED(plnr);
return (1
Expand Down
12 changes: 6 additions & 6 deletions dft/ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
*
*/

/* $Id: ct.c,v 1.46 2005-04-10 20:33:24 athena Exp $ */
/* $Id: ct.c,v 1.47 2005-12-18 01:28:50 athena Exp $ */

#include "ct.h"

ct_solver *(*X(mksolver_ct_hook))(size_t, int, int, ct_mkinferior) = 0;
ct_solver *(*X(mksolver_ct_hook))(size_t, INT, int, ct_mkinferior) = 0;

typedef struct {
plan_dft super;
plan *cld;
plan *cldw;
int r;
INT r;
} P;

static void apply_dit(const plan *ego_, R *ri, R *ii, R *ro, R *io)
Expand Down Expand Up @@ -83,7 +83,7 @@ static int applicable0(const ct_solver *ego, const problem *p_, planner *plnr)
{
if (DFTP(p_)) {
const problem_dft *p = (const problem_dft *) p_;
int r;
INT r;

return (1
&& p->sz->rnk == 1
Expand Down Expand Up @@ -124,7 +124,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
const problem_dft *p;
P *pln = 0;
plan *cld = 0, *cldw = 0;
int n, r, m, vl, ivs, ovs;
INT n, r, m, vl, ivs, ovs;
iodim *d;
tensor *t1, *t2;

Expand Down Expand Up @@ -203,7 +203,7 @@ static plan *mkplan(const solver *ego_, const problem *p_, planner *plnr)
return (plan *) 0;
}

ct_solver *X(mksolver_ct)(size_t size, int r, int dec, ct_mkinferior mkcldw)
ct_solver *X(mksolver_ct)(size_t size, INT r, int dec, ct_mkinferior mkcldw)
{
static const solver_adt sadt = { mkplan };
ct_solver *slv = (ct_solver *)X(mksolver)(size, &sadt);
Expand Down
10 changes: 5 additions & 5 deletions dft/ct.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
typedef void (*dftwapply) (const plan *ego, R *rio, R *iio);
typedef struct ct_solver_s ct_solver;
typedef plan *(*ct_mkinferior)(const ct_solver *ego,
int dec, int r, int m, int s, int vl, int vs,
int mstart, int mcount,
int dec, INT r, INT m, INT s, INT vl, INT vs,
INT mstart, INT mcount,
R *rio, R *iio,
planner *plnr);

Expand All @@ -40,7 +40,7 @@ extern plan *X(mkplan_dftw)(size_t size, const plan_adt *adt, dftwapply apply);

struct ct_solver_s {
solver super;
int r;
INT r;
int dec;
# define DECDIF 0
# define DECDIT 1
Expand All @@ -49,8 +49,8 @@ struct ct_solver_s {
};

int X(ct_applicable)(const ct_solver *, const problem *, planner *);
ct_solver *X(mksolver_ct)(size_t size, int r, int dec, ct_mkinferior mkcldw);
extern ct_solver *(*X(mksolver_ct_hook))(size_t, int, int, ct_mkinferior);
ct_solver *X(mksolver_ct)(size_t size, INT r, int dec, ct_mkinferior mkcldw);
extern ct_solver *(*X(mksolver_ct_hook))(size_t, INT, int, ct_mkinferior);

void X(regsolver_ct_directw)(planner *plnr,
kdftw codelet, const ct_desc *desc, int dec);
Expand Down
Loading

0 comments on commit e99c678

Please sign in to comment.