Move MIN,MAX,SQ macros to a common header

Former-commit-id: 5f2598476b090ca3f9254325c1f69315182c8c30
This commit is contained in:
Marek Nečada 2020-04-26 15:58:18 +03:00
parent 8ed4bdb683
commit 999dc7f72e
5 changed files with 13 additions and 12 deletions

View File

@ -29,9 +29,6 @@
#define M_SQRTPI 1.7724538509055160272981674833411452
#endif
#define MAX(x,y) ((x)<(y)?(y):(x))
#define MIN(x,y) ((x)<(y)?(x):(y))
// sloppy implementation of factorial
static inline double factorial(const int n) {

View File

@ -45,4 +45,17 @@ static inline complex double ipow(int x) {
static inline int isq(int x) {return x * x;}
#ifndef MIN
#define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#ifndef MAX
#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
#endif
#ifndef SQ
#define SQ(x) ((x) * (x))
#endif
#endif // TINY_INLINES_H

View File

@ -36,10 +36,6 @@
#define ELECTRONVOLT (1.602176487e-19)
#define SCUFF_OMEGAUNIT (3e14)
#define SQ(x) ((x)*(x))
#define MAX(x,y) ((x) < (y) ? (y) : (x))
#define MIN(x,y) ((x) > (y) ? (y) : (x))
qpms_tmatrix_t *qpms_tmatrix_init(const qpms_vswf_set_spec_t *bspec) {
qpms_tmatrix_t *t;
QPMS_CRASHING_MALLOC(t, sizeof(qpms_tmatrix_t));

View File

@ -308,8 +308,6 @@ static inline size_t qpms_trans_calculator_index_yyu(const qpms_trans_calculator
}
#define SQ(x) ((x)*(x))
static inline double fsq(double x) {return x * x; }
static void qpms_trans_calculator_multipliers_A(

View File

@ -3,9 +3,6 @@
#include "kahansum.h"
#define WIGNER_ATOL (1e-15)
#define MIN(a,b) ((a)<(b)?(a):b)
#define MAX(a,b) ((a)>(b)?(a):b)
complex double qpms_wignerD_elem(const qpms_quat_t R,
const qpms_l_t l, const qpms_m_t mp, const qpms_m_t m) {
// TODO do some optimisations... The combinatoric coeffs could be precomputed.