5 static inline int min1pow(int pow
) { return (pow
% 2) ? -1 : 1; }
8 // This is useful for calculating spherical harmonics with negative m
9 // if spharm-normalised legendre functions for positive m are available.
10 // TODO: write a function that gets legendre buffer, m, n, and returns the correct spharm
11 // and use it in the code (mainly translations.c, ewald.c).
12 static inline int min1pow_m_neg(int m
) {
13 return (m
< 0) ? min1pow(m
) : 1;
18 #ifdef __GSL_SF_LEGENDRE_H__
19 static inline complex double
20 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
) {
27 // this has shitty precision:
28 // static inline complex double ipow(int x) { return cpow(I, x); }
30 static inline complex double ipow(int x
) {
31 x
= ((x
% 4) + 4) % 4;
46 static inline int isq(int x
) {return x
* x
;}
49 #define MIN(x, y) (((x) < (y)) ? (x) : (y))
53 #define MAX(x, y) (((x) >= (y)) ? (x) : (y))
57 #define SQ(x) ((x) * (x))
61 #endif // TINY_INLINES_H