diff options
author | Thomas White <taw@physics.org> | 2023-09-15 17:16:39 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2023-09-18 17:13:15 +0200 |
commit | 322af5ff0c94d69cef972be9e87df6697d9d7679 (patch) | |
tree | f6d2b1813a5add7aead1d682801463f19182cb53 /libcrystfel/src/utils.h | |
parent | e720290743e536e8c05695d22c939cf433055336 (diff) |
Use a*a instead of pow(a, 2)
Diffstat (limited to 'libcrystfel/src/utils.h')
-rw-r--r-- | libcrystfel/src/utils.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libcrystfel/src/utils.h b/libcrystfel/src/utils.h index 67940ad4..3a228b22 100644 --- a/libcrystfel/src/utils.h +++ b/libcrystfel/src/utils.h @@ -105,6 +105,11 @@ extern double flat_noise(gsl_rng *rng, double expected, double width); extern double gaussian_noise(gsl_rng *rng, double expected, double stddev); extern int poisson_noise(gsl_rng *rng, double expected); +static inline double sq(double a) +{ + return a*a; +} + static inline double distance(double x1, double y1, double x2, double y2) { return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1)); |