Commit 79b58a9c authored by Martin Reinecke's avatar Martin Reinecke
Browse files

no more typedefs

parent 513c1b5b
......@@ -42,8 +42,8 @@
using namespace std;
typedef complex<double> dcmplx;
typedef complex<float> fcmplx;
using dcmplx = complex<double>;
using fcmplx = complex<float>;
static const double sqrt_one_half = 0.707106781186547572737310929369;
static const double sqrt_two = 1.414213562373095145474621858739;
......
......@@ -33,35 +33,35 @@
/*! \internal
Helper type containing information about a single ring. */
typedef struct
struct sharp_ringinfo
{
double theta, phi0, weight, cth, sth;
ptrdiff_t ofs;
int nph, stride;
} sharp_ringinfo;
};
/*! \internal
Helper type containing information about a pair of rings with colatitudes
symmetric around the equator. */
typedef struct
struct sharp_ringpair
{
sharp_ringinfo r1,r2;
} sharp_ringpair;
};
/*! \internal
Type holding all required information about a map geometry. */
typedef struct
struct sharp_geom_info
{
std::vector<sharp_ringpair> pair;
int nphmax;
} sharp_geom_info;
};
/*! \defgroup almgroup Helpers for dealing with a_lm */
/*! \{ */
/*! \internal
Helper type for index calculation in a_lm arrays. */
typedef struct
struct sharp_alm_info
{
/*! Maximum \a l index of the array */
int lmax;
......@@ -76,10 +76,10 @@ typedef struct
std::vector<ptrdiff_t> mvstart;
/*! Stride between a_lm and a_(l+1),m */
ptrdiff_t stride;
} sharp_alm_info;
};
/*! alm_info flags */
typedef enum { SHARP_PACKED = 1,
enum sharp_almflags { SHARP_PACKED = 1,
/*!< m=0-coefficients are packed so that the (zero) imaginary part is
not present. mvstart is in units of *real* float/double for all
m; stride is in units of reals for m=0 and complex for m!=0 */
......@@ -94,7 +94,7 @@ typedef enum { SHARP_PACKED = 1,
corresponding complex coefficient (when accessed
as complex).
*/
} sharp_almflags;
};
......@@ -170,17 +170,17 @@ void sharp_destroy_geom_info (sharp_geom_info *info);
/*! \{ */
/*! Enumeration of SHARP job types. */
typedef enum { SHARP_YtW=0, /*!< analysis */
enum sharp_jobtype { SHARP_YtW=0, /*!< analysis */
SHARP_MAP2ALM=SHARP_YtW, /*!< analysis */
SHARP_Y=1, /*!< synthesis */
SHARP_ALM2MAP=SHARP_Y, /*!< synthesis */
SHARP_Yt=2, /*!< adjoint synthesis */
SHARP_WY=3, /*!< adjoint analysis */
SHARP_ALM2MAP_DERIV1=4 /*!< synthesis of first derivatives */
} sharp_jobtype;
};
/*! Job flags */
typedef enum { SHARP_DP = 1<<4,
enum sharp_jobflags { SHARP_DP = 1<<4,
/*!< map and a_lm are in double precision */
SHARP_ADD = 1<<5,
/*!< results are added to the output arrays, instead of
......@@ -192,7 +192,7 @@ typedef enum { SHARP_DP = 1<<4,
SHARP_NO_FFT = 1<<7,
SHARP_USE_WEIGHTS = 1<<20, /* internal use only */
} sharp_jobflags;
};
/*! Performs a libsharp2 SHT job. The interface deliberately does not use
the C99 "complex" data type, in order to be callable from C89 and C++.
......
......@@ -31,12 +31,12 @@
#undef GENERIC_ARCH
#undef ARCH
typedef void (*t_inner_loop) (sharp_job *job, const int *ispair,
using t_inner_loop = void (*) (sharp_job *job, const int *ispair,
const double *cth_, const double *sth_, int llim, int ulim,
sharp_Ylmgen &gen, int mi, const int *mlim);
typedef int (*t_veclen) (void);
typedef int (*t_max_nvec) (int spin);
typedef const char *(*t_architecture) (void);
using t_veclen = int (*) (void);
using t_max_nvec = int (*) (int spin);
using t_architecture = const char *(*) (void);
static t_inner_loop inner_loop_ = NULL;
static t_veclen veclen_ = NULL;
......
......@@ -82,50 +82,50 @@ static inline void vhsum_cmplx_special (Tv a, Tv b, Tv c, Tv d,
// Unfortunately, most compilers don't act on this pragma yet.
#pragma STDC FP_CONTRACT ON
typedef complex<double> dcmplx;
using dcmplx = complex<double>;
#define nv0 (128/VLEN)
#define nvx (64/VLEN)
typedef Tv Tbv0[nv0];
typedef double Tbs0[nv0*VLEN];
using Tbv0 = Tv[nv0];
using Tbs0 = double[nv0*VLEN];
typedef struct
struct s0data_v
{
Tbv0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i;
} s0data_v;
};
typedef struct
struct s0data_s
{
Tbs0 sth, corfac, scale, lam1, lam2, csq, p1r, p1i, p2r, p2i;
} s0data_s;
};
typedef union
union s0data_u
{
s0data_v v;
s0data_s s;
} s0data_u;
};
typedef Tv Tbvx[nvx];
typedef double Tbsx[nvx*VLEN];
using Tbvx = Tv[nvx];
using Tbsx = double[nvx*VLEN];
typedef struct
struct sxdata_v
{
Tbvx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth,
p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi;
} sxdata_v;
};
typedef struct
struct sxdata_s
{
Tbsx sth, cfp, cfm, scp, scm, l1p, l2p, l1m, l2m, cth,
p1pr, p1pi, p2pr, p2pi, p1mr, p1mi, p2mr, p2mi;
} sxdata_s;
};
typedef union
union sxdata_u
{
sxdata_v v;
sxdata_s s;
} sxdata_u;
};
static inline void Tvnormalize (Tv * MRUTIL_RESTRICT val, Tv * MRUTIL_RESTRICT scale,
double maxval)
......@@ -191,8 +191,8 @@ static void mypow(Tv val, int npow, const vector<double> &powlimit,
static inline void getCorfac(Tv scale, Tv * MRUTIL_RESTRICT corfac,
const vector<double> &cf)
{
typedef union
{ Tv v; double s[VLEN]; } Tvu;
union Tvu
{ Tv v; double s[VLEN]; };
Tvu sc, corf;
sc.v=scale;
......
......@@ -34,7 +34,7 @@
using std::complex;
typedef struct
struct sharp_job
{
sharp_jobtype type;
int spin;
......@@ -50,7 +50,7 @@ typedef struct
const sharp_alm_info *ainfo;
double time;
unsigned long long opcnt;
} sharp_job;
};
void inner_loop (sharp_job *job, const int *ispair,const double *cth,
const double *sth, int llim, int ulim, sharp_Ylmgen &gen, int mi,
......
......@@ -208,7 +208,7 @@ class Distribution
size_t chunksize_;
double fact_max_;
vector<size_t> nextstart;
typedef enum { SINGLE, STATIC, DYNAMIC } SchedMode;
enum SchedMode { SINGLE, STATIC, DYNAMIC };
SchedMode mode;
bool single_done;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment