apply clang-format to all headers with some exceptions

This commit is contained in:
Axel Kohlmeyer
2021-05-14 19:16:07 -04:00
parent 60e41a90c2
commit 7fcd449864
1651 changed files with 15108 additions and 15948 deletions

View File

@ -31,15 +31,17 @@ namespace MathSpecial {
// fast 2**x function without argument checks for little endian CPUs
extern double exp2_x86(double x);
// fast e**x function for little endian CPUs, falls back to libc on other platforms
// fast e**x function for little endian CPUs, falls back to libc on other platforms
extern double fm_exp(double x);
// scaled error function complement exp(x*x)*erfc(x) for coul/long styles
static inline double my_erfcx(const double x)
{
if (x >= 0.0) return erfcx_y100(400.0/(4.0+x));
else return 2.0*exp(x*x) - erfcx_y100(400.0/(4.0-x));
if (x >= 0.0)
return erfcx_y100(400.0 / (4.0 + x));
else
return 2.0 * exp(x * x) - erfcx_y100(400.0 / (4.0 - x));
}
// exp(-x*x) for coul/long styles
@ -47,7 +49,7 @@ namespace MathSpecial {
static inline double expmsq(double x)
{
x *= x;
x *= 1.4426950408889634074; // log_2(e)
x *= 1.4426950408889634074; // log_2(e)
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
return (x < 1023.0) ? exp2_x86(-x) : 0.0;
#else
@ -57,10 +59,10 @@ namespace MathSpecial {
// x**2, use instead of pow(x,2.0)
static inline double square(const double &x) { return x*x; }
static inline double square(const double &x) { return x * x; }
// x**3, use instead of pow(x,3.0)
static inline double cube(const double &x) { return x*x*x; }
static inline double cube(const double &x) { return x * x * x; }
// return -1.0 for odd n, 1.0 for even n, like pow(-1.0,n)
static inline double powsign(const int n) { return (n & 1) ? -1.0 : 1.0; }
@ -68,34 +70,36 @@ namespace MathSpecial {
// optimized version of pow(x,n) with n being integer
// up to 10x faster than pow(x,y)
static inline double powint(const double &x, const int n) {
double yy,ww;
static inline double powint(const double &x, const int n)
{
double yy, ww;
if (x == 0.0) return 0.0;
int nn = (n > 0) ? n : -n;
ww = x;
for (yy = 1.0; nn != 0; nn >>= 1, ww *=ww)
for (yy = 1.0; nn != 0; nn >>= 1, ww *= ww)
if (nn & 1) yy *= ww;
return (n > 0) ? yy : 1.0/yy;
return (n > 0) ? yy : 1.0 / yy;
}
// optimized version of (sin(x)/x)**n with n being a _positive_ integer
static inline double powsinxx(const double &x, int n) {
double yy,ww;
static inline double powsinxx(const double &x, int n)
{
double yy, ww;
if (x == 0.0) return 1.0;
ww = sin(x)/x;
ww = sin(x) / x;
for (yy = 1.0; n != 0; n >>= 1, ww *=ww)
for (yy = 1.0; n != 0; n >>= 1, ww *= ww)
if (n & 1) yy *= ww;
return yy;
}
}
}
} // namespace MathSpecial
} // namespace LAMMPS_NS
#endif