aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2018-06-29 09:56:54 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2018-06-29 13:25:58 +0100
commit5e8389113b47a48622d1de8beb9a4adc2b332694 (patch)
tree88e1303e741d50737c310a13e3fa49a2d2c92d37
parent4aa92161d340899eaf3cd1b599a72109ba818c22 (diff)
downloadarm-optimized-routines-5e8389113b47a48622d1de8beb9a4adc2b332694.tar.gz
Fix GNU style issues
Whitespace changes only.
-rw-r--r--math/exp.c12
-rw-r--r--math/exp2.c10
-rw-r--r--math/log.c45
-rw-r--r--math/log2.c30
-rw-r--r--math/math_config.h12
-rw-r--r--math/pow.c15
-rw-r--r--math/pow_log_data.c2
-rw-r--r--math/sincosf.c16
-rw-r--r--math/sinf.c12
9 files changed, 81 insertions, 73 deletions
diff --git a/math/exp.c b/math/exp.c
index cc72780..e73f2a6 100644
--- a/math/exp.c
+++ b/math/exp.c
@@ -124,27 +124,27 @@ exp_inline (double x, double xtail, int hastail)
ki = asuint64 (kd);
kd -= Shift;
#endif
- r = x + kd*NegLn2hiN + kd*NegLn2loN;
+ r = x + kd * NegLn2hiN + kd * NegLn2loN;
/* The code assumes 2^-200 < |xtail| < 2^-8/N. */
if (hastail)
r += xtail;
/* 2^(k/N) ~= scale * (1 + tail). */
- idx = 2*(ki % N);
+ idx = 2 * (ki % N);
top = ki << (52 - EXP_TABLE_BITS);
tail = asdouble (T[idx]);
/* This is only a valid scale when -1023*N < k < 1024*N. */
sbits = T[idx + 1] + top;
/* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */
/* Evaluation is optimized assuming superscalar pipelined execution. */
- r2 = r*r;
+ r2 = r * r;
/* Without fma the worst case error is 0.25/N ulp larger. */
/* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */
#if EXP_POLY_ORDER == 4
- tmp = tail + r + r2*C2 + r*r2*(C3 + r*C4);
+ tmp = tail + r + r2 * C2 + r * r2 * (C3 + r * C4);
#elif EXP_POLY_ORDER == 5
- tmp = tail + r + r2*(C2 + r*C3) + r2*r2*(C4 + r*C5);
+ tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);
#elif EXP_POLY_ORDER == 6
- tmp = tail + r + r2*(0.5 + r*C3) + r2*r2*(C4 + r*C5 + r2*C6);
+ tmp = tail + r + r2 * (0.5 + r * C3) + r2 * r2 * (C4 + r * C5 + r2 * C6);
#endif
if (unlikely (abstop == 0))
return specialcase (tmp, sbits, ki);
diff --git a/math/exp2.c b/math/exp2.c
index 5acabf2..3d8aadf 100644
--- a/math/exp2.c
+++ b/math/exp2.c
@@ -113,22 +113,22 @@ exp2 (double x)
kd -= Shift; /* k/N for int k. */
r = x - kd;
/* 2^(k/N) ~= scale * (1 + tail). */
- idx = 2*(ki % N);
+ idx = 2 * (ki % N);
top = ki << (52 - EXP_TABLE_BITS);
tail = asdouble (T[idx]);
/* This is only a valid scale when -1023*N < k < 1024*N. */
sbits = T[idx + 1] + top;
/* exp2(x) = 2^(k/N) * 2^r ~= scale + scale * (tail + 2^r - 1). */
/* Evaluation is optimized assuming superscalar pipelined execution. */
- r2 = r*r;
+ r2 = r * r;
/* Without fma the worst case error is 0.5/N ulp larger. */
/* Worst case error is less than 0.5+0.86/N+(abs poly error * 2^53) ulp. */
#if EXP2_POLY_ORDER == 4
- tmp = tail + r*C1 + r2*C2 + r*r2*(C3 + r*C4);
+ tmp = tail + r * C1 + r2 * C2 + r * r2 * (C3 + r * C4);
#elif EXP2_POLY_ORDER == 5
- tmp = tail + r*C1 + r2*(C2 + r*C3) + r2*r2*(C4 + r*C5);
+ tmp = tail + r * C1 + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);
#elif EXP2_POLY_ORDER == 6
- tmp = tail + r*C1 + r2*(0.5 + r*C3) + r2*r2*(C4 + r*C5 + r2*C6);
+ tmp = tail + r * C1 + r2 * (0.5 + r * C3) + r2 * r2 * (C4 + r * C5 + r2 * C6);
#endif
if (unlikely (abstop == 0))
return specialcase (tmp, sbits, ki);
diff --git a/math/log.c b/math/log.c
index e021f3f..324936d 100644
--- a/math/log.c
+++ b/math/log.c
@@ -62,44 +62,44 @@ log (double x)
if (WANT_ROUNDING && unlikely (ix == asuint64 (1.0)))
return 0;
r = x - 1.0;
- r2 = r*r;
- r3 = r*r2;
+ r2 = r * r;
+ r3 = r * r2;
#if LOG_POLY1_ORDER == 10
/* Worst-case error is around 0.516 ULP. */
- y = r3*(B[1] + r*B[2] + r2*B[3]
- + r3*(B[4] + r*B[5] + r2*B[6] + r3*(B[7] + r*B[8])));
- w = B[0]*r2; /* B[0] == -0.5. */
+ y = r3 * (B[1] + r * B[2] + r2 * B[3]
+ + r3 * (B[4] + r * B[5] + r2 * B[6] + r3 * (B[7] + r * B[8])));
+ w = B[0] * r2; /* B[0] == -0.5. */
hi = r + w;
y += r - hi + w;
y += hi;
#elif LOG_POLY1_ORDER == 11
/* Worst-case error is around 0.516 ULP. */
- y = r3*(B[1] + r*B[2]
- + r2*(B[3] + r*B[4] + r2*B[5]
- + r3*(B[6] + r*B[7] + r2*B[8] + r3*B[9])));
- w = B[0]*r2; /* B[0] == -0.5. */
+ y = r3 * (B[1] + r * B[2]
+ + r2 * (B[3] + r * B[4] + r2 * B[5]
+ + r3 * (B[6] + r * B[7] + r2 * B[8] + r3 * B[9])));
+ w = B[0] * r2; /* B[0] == -0.5. */
hi = r + w;
y += r - hi + w;
y += hi;
#elif LOG_POLY1_ORDER == 12
- y = r3*(B[1] + r*B[2] + r2*B[3]
- + r3*(B[4] + r*B[5] + r2*B[6]
- + r3*(B[7] + r*B[8] + r2*B[9] + r3*B[10])));
+ y = r3 * (B[1] + r * B[2] + r2 * B[3]
+ + r3 * (B[4] + r * B[5] + r2 * B[6]
+ + r3 * (B[7] + r * B[8] + r2 * B[9] + r3 * B[10])));
# if N <= 64
/* Worst-case error is around 0.532 ULP. */
- w = B[0]*r2; /* B[0] == -0.5. */
+ w = B[0] * r2; /* B[0] == -0.5. */
hi = r + w;
y += r - hi + w;
y += hi;
# else
/* Worst-case error is around 0.507 ULP. */
- w = r*0x1p27;
+ w = r * 0x1p27;
double_t rhi = r + w - w;
double_t rlo = r - rhi;
- w = rhi*rhi*B[0]; /* B[0] == -0.5. */
+ w = rhi * rhi * B[0]; /* B[0] == -0.5. */
hi = r + w;
lo = r - hi + w;
- lo += B[0]*rlo*(rhi + r);
+ lo += B[0] * rlo * (rhi + r);
y += lo;
y += hi;
# endif
@@ -138,14 +138,14 @@ log (double x)
r = fma (z, invc, -1.0);
#else
/* rounding error: 0x1p-55/N + 0x1p-66. */
- r = (z - T2[i].chi - T2[i].clo)*invc;
+ r = (z - T2[i].chi - T2[i].clo) * invc;
#endif
kd = (double_t) k;
/* hi + lo = r + log(c) + k*Ln2. */
- w = kd*Ln2hi + logc;
+ w = kd * Ln2hi + logc;
hi = w + r;
- lo = w - hi + r + kd*Ln2lo;
+ lo = w - hi + r + kd * Ln2lo;
/* log(x) = lo + (log1p(r) - r) + hi. */
r2 = r * r; /* rounding error: 0x1p-54/N^2. */
@@ -154,9 +154,12 @@ log (double x)
Worst case error if |y| > 0x1p-4:
0.5 + 2.06/N + abs-poly-error*2^56 ULP (+ 0.001 ULP without fma). */
#if LOG_POLY_ORDER == 6
- y = lo + r2*A[0] + r*r2*(A[1] + r*A[2] + r2*(A[3] + r*A[4])) + hi;
+ y = lo + r2 * A[0] + r * r2 * (A[1] + r * A[2] + r2 * (A[3] + r * A[4])) + hi;
#elif LOG_POLY_ORDER == 7
- y = lo + r2*(A[0] + r*A[1] + r2*(A[2] + r*A[3]) + r2*r2*(A[4] + r*A[5])) + hi;
+ y = lo
+ + r2 * (A[0] + r * A[1] + r2 * (A[2] + r * A[3])
+ + r2 * r2 * (A[4] + r * A[5]))
+ + hi;
#endif
return y;
}
diff --git a/math/log2.c b/math/log2.c
index ebe207a..2b3960d 100644
--- a/math/log2.c
+++ b/math/log2.c
@@ -60,24 +60,24 @@ log2 (double x)
return 0;
r = x - 1.0;
#if HAVE_FAST_FMA
- hi = r*InvLn2hi;
- lo = r*InvLn2lo + fma (r, InvLn2hi, -hi);
+ hi = r * InvLn2hi;
+ lo = r * InvLn2lo + fma (r, InvLn2hi, -hi);
#else
double_t rhi, rlo;
- rhi = asdouble (asuint64 (r) & -1ULL<<32);
+ rhi = asdouble (asuint64 (r) & -1ULL << 32);
rlo = r - rhi;
- hi = rhi*InvLn2hi;
- lo = rlo*InvLn2hi + r*InvLn2lo;
+ hi = rhi * InvLn2hi;
+ lo = rlo * InvLn2hi + r * InvLn2lo;
#endif
r2 = r * r; /* rounding error: 0x1p-62. */
r4 = r2 * r2;
#if LOG2_POLY1_ORDER == 11
/* Worst-case error is less than 0.54 ULP (0.55 ULP without fma). */
- p = r2*(B[0] + r*B[1]);
+ p = r2 * (B[0] + r * B[1]);
y = hi + p;
lo += hi - y + p;
- lo += r4*(B[2] + r*B[3] + r2*(B[4] + r*B[5])
- + r4*(B[6] + r*B[7] + r2*(B[8] + r*B[9])));
+ lo += r4 * (B[2] + r * B[3] + r2 * (B[4] + r * B[5])
+ + r4 * (B[6] + r * B[7] + r2 * (B[8] + r * B[9])));
y += lo;
#endif
return y;
@@ -113,16 +113,16 @@ log2 (double x)
#if HAVE_FAST_FMA
/* rounding error: 0x1p-55/N. */
r = fma (z, invc, -1.0);
- t1 = r*InvLn2hi;
- t2 = r*InvLn2lo + fma (r, InvLn2hi, -t1);
+ t1 = r * InvLn2hi;
+ t2 = r * InvLn2lo + fma (r, InvLn2hi, -t1);
#else
double_t rhi, rlo;
/* rounding error: 0x1p-55/N + 0x1p-65. */
- r = (z - T2[i].chi - T2[i].clo)*invc;
+ r = (z - T2[i].chi - T2[i].clo) * invc;
rhi = asdouble (asuint64 (r) & -1ULL << 32);
rlo = r - rhi;
- t1 = rhi*InvLn2hi;
- t2 = rlo*InvLn2hi + r*InvLn2lo;
+ t1 = rhi * InvLn2hi;
+ t2 = rlo * InvLn2hi + r * InvLn2lo;
#endif
/* hi + lo = r/ln2 + log2(c) + k. */
@@ -137,8 +137,8 @@ log2 (double x)
#if LOG2_POLY_ORDER == 7
/* Worst-case error if |y| > 0x1p-4: 0.547 ULP (0.550 ULP without fma).
~ 0.5 + 2/N/ln2 + abs-poly-error*0x1p56 ULP (+ 0.003 ULP without fma). */
- p = A[0] + r*A[1] + r2*(A[2] + r*A[3]) + r4*(A[4] + r*A[5]);
- y = lo + r2*p + hi;
+ p = A[0] + r * A[1] + r2 * (A[2] + r * A[3]) + r4 * (A[4] + r * A[5]);
+ y = lo + r2 * p + hi;
#endif
return y;
}
diff --git a/math/math_config.h b/math/math_config.h
index 61aca10..3986d48 100644
--- a/math/math_config.h
+++ b/math/math_config.h
@@ -333,7 +333,8 @@ extern const struct powf_log2_data
#define EXP_USE_TOINT_NARROW 0
#define EXP2_POLY_ORDER 5
#define EXP2_POLY_WIDE 0
-extern const struct exp_data {
+extern const struct exp_data
+{
double invln2N;
double shift;
double negln2hiN;
@@ -347,7 +348,8 @@ extern const struct exp_data {
#define LOG_TABLE_BITS 7
#define LOG_POLY_ORDER 6
#define LOG_POLY1_ORDER 12
-extern const struct log_data {
+extern const struct log_data
+{
double ln2hi;
double ln2lo;
double poly[LOG_POLY_ORDER - 1]; /* First coefficient is 1. */
@@ -361,7 +363,8 @@ extern const struct log_data {
#define LOG2_TABLE_BITS 6
#define LOG2_POLY_ORDER 7
#define LOG2_POLY1_ORDER 11
-extern const struct log2_data {
+extern const struct log2_data
+{
double invln2hi;
double invln2lo;
double poly[LOG2_POLY_ORDER - 1];
@@ -374,7 +377,8 @@ extern const struct log2_data {
#define POW_LOG_TABLE_BITS 7
#define POW_LOG_POLY_ORDER 8
-extern const struct pow_log_data {
+extern const struct pow_log_data
+{
double ln2hi;
double ln2lo;
double poly[POW_LOG_POLY_ORDER - 1]; /* First coefficient is 1. */
diff --git a/math/pow.c b/math/pow.c
index 0d6e709..90f2976 100644
--- a/math/pow.c
+++ b/math/pow.c
@@ -99,7 +99,8 @@ log_inline (uint64_t ix, double_t *tail)
#endif
/* p = log1p(r) - r - A[0]*r*r. */
#if POW_LOG_POLY_ORDER == 8
- p = ar3*(A[1] + r*A[2] + ar2*(A[3] + r*A[4] + ar2*(A[5] + r*A[6])));
+ p = ar3
+ * (A[1] + r * A[2] + ar2 * (A[3] + r * A[4] + ar2 * (A[5] + r * A[6])));
#endif
lo = lo1 + lo2 + lo3 + lo4 + p;
y = hi + lo;
@@ -211,26 +212,26 @@ exp_inline (double x, double xtail, uint32_t sign_bias)
ki = asuint64 (kd);
kd -= Shift;
#endif
- r = x + kd*NegLn2hiN + kd*NegLn2loN;
+ r = x + kd * NegLn2hiN + kd * NegLn2loN;
/* The code assumes 2^-200 < |xtail| < 2^-8/N. */
r += xtail;
/* 2^(k/N) ~= scale * (1 + tail). */
- idx = 2*(ki % N);
+ idx = 2 * (ki % N);
top = (ki + sign_bias) << (52 - EXP_TABLE_BITS);
tail = asdouble (T[idx]);
/* This is only a valid scale when -1023*N < k < 1024*N. */
sbits = T[idx + 1] + top;
/* exp(x) = 2^(k/N) * exp(r) ~= scale + scale * (tail + exp(r) - 1). */
/* Evaluation is optimized assuming superscalar pipelined execution. */
- r2 = r*r;
+ r2 = r * r;
/* Without fma the worst case error is 0.25/N ulp larger. */
/* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */
#if EXP_POLY_ORDER == 4
- tmp = tail + r + r2*C2 + r*r2*(C3 + r*C4);
+ tmp = tail + r + r2 * C2 + r * r2 * (C3 + r * C4);
#elif EXP_POLY_ORDER == 5
- tmp = tail + r + r2*(C2 + r*C3) + r2*r2*(C4 + r*C5);
+ tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);
#elif EXP_POLY_ORDER == 6
- tmp = tail + r + r2*(0.5 + r*C3) + r2*r2*(C4 + r*C5 + r2*C6);
+ tmp = tail + r + r2 * (0.5 + r * C3) + r2 * r2 * (C4 + r * C5 + r2 * C6);
#endif
if (unlikely (abstop == 0))
return specialcase (tmp, sbits, ki);
diff --git a/math/pow_log_data.c b/math/pow_log_data.c
index 9524579..1b73b7f 100644
--- a/math/pow_log_data.c
+++ b/math/pow_log_data.c
@@ -40,7 +40,7 @@ const struct pow_log_data __pow_log_data = {
},
.tab = {
#if N == 128
-#define A(a,b,c) {a,0,b,c},
+#define A(a, b, c) {a, 0, b, c},
A(0x1.6a00000000000p+0, -0x1.62c82f2b9c800p-2, 0x1.ab42428375680p-48)
A(0x1.6800000000000p+0, -0x1.5d1bdbf580800p-2, -0x1.ca508d8e0f720p-46)
A(0x1.6600000000000p+0, -0x1.5767717455800p-2, -0x1.362a4d5b6506dp-45)
diff --git a/math/sincosf.c b/math/sincosf.c
index 4ea2b1d..2363a42 100644
--- a/math/sincosf.c
+++ b/math/sincosf.c
@@ -44,14 +44,14 @@ sincosf (float y, float *sinp, float *cosp)
double x2 = x * x;
if (unlikely (abstop12 (y) < abstop12 (0x1p-12f)))
- {
- if (unlikely (abstop12 (y) < abstop12 (0x1p-126f)))
- /* Force underflow for tiny y. */
- force_eval_float (x2);
- *sinp = y;
- *cosp = 1.0f;
- return;
- }
+ {
+ if (unlikely (abstop12 (y) < abstop12 (0x1p-126f)))
+ /* Force underflow for tiny y. */
+ force_eval_float (x2);
+ *sinp = y;
+ *cosp = 1.0f;
+ return;
+ }
sincosf_poly (x, x2, p, 0, sinp, cosp);
}
diff --git a/math/sinf.c b/math/sinf.c
index 3c7dfe3..8c6e366 100644
--- a/math/sinf.c
+++ b/math/sinf.c
@@ -43,12 +43,12 @@ sinf (float y)
s = x * x;
if (unlikely (abstop12 (y) < abstop12 (0x1p-12f)))
- {
- if (unlikely (abstop12 (y) < abstop12 (0x1p-126f)))
- /* Force underflow for tiny y. */
- force_eval_float (s);
- return y;
- }
+ {
+ if (unlikely (abstop12 (y) < abstop12 (0x1p-126f)))
+ /* Force underflow for tiny y. */
+ force_eval_float (s);
+ return y;
+ }
return sinf_poly (x, s, p, 0);
}