1 /*! \file tiny_inlines.h
2 * \brief Simple but frequently used inline functions and macros.
8 static inline int min1pow(int pow
) { return (pow
% 2) ? -1 : 1; }
11 // This is useful for calculating spherical harmonics with negative m
12 // if spharm-normalised legendre functions for positive m are available.
13 // TODO: write a function that gets legendre buffer, m, n, and returns the correct spharm
14 // and use it in the code (mainly translations.c, ewald.c).
15 static inline int min1pow_m_neg(int m
) {
16 return (m
< 0) ? min1pow(m
) : 1;
21 #ifdef __GSL_SF_LEGENDRE_H__
22 static inline complex double
23 spharm_eval(gsl_sf_legendre_t P_normconv
, int P_csphase
, qpms_l_t l
, qpms_m_t m
, double P_n_abs_m
, complex double exp_imf
) {
30 // this has shitty precision:
31 // static inline complex double ipow(int x) { return cpow(I, x); }
33 static inline complex double ipow(int x
) {
34 x
= ((x
% 4) + 4) % 4;
49 static inline int isq(int x
) {return x
* x
;}
52 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
56 #define MAX(x, y) (((x) >= (y)) ? (x) : (y))
60 #define SQ(x) ((x) * (x))
64 #endif // TINY_INLINES_H