Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Unified Diff: fusl/src/complex/__cexpf.c

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fusl/src/complex/__cexpf.c
diff --git a/fusl/src/complex/__cexpf.c b/fusl/src/complex/__cexpf.c
index 69b54045afd4a8e953e19e72e1cf7a0f902d4f89..d8b57925b256372e3f48d09986ad61c6c94d29f1 100644
--- a/fusl/src/complex/__cexpf.c
+++ b/fusl/src/complex/__cexpf.c
@@ -27,7 +27,7 @@
#include "libm.h"
-static const uint32_t k = 235; /* constant for reduction */
+static const uint32_t k = 235; /* constant for reduction */
static const float kln2 = 162.88958740F; /* k * ln2 */
/*
@@ -36,33 +36,31 @@ static const float kln2 = 162.88958740F; /* k * ln2 */
* Input: ln(FLT_MAX) <= x < ln(2 * FLT_MAX / FLT_MIN_DENORM) ~= 192.7
* Output: 2**127 <= y < 2**128
*/
-static float __frexp_expf(float x, int *expt)
-{
- float exp_x;
- uint32_t hx;
+static float __frexp_expf(float x, int* expt) {
+ float exp_x;
+ uint32_t hx;
- exp_x = expf(x - kln2);
- GET_FLOAT_WORD(hx, exp_x);
- *expt = (hx >> 23) - (0x7f + 127) + k;
- SET_FLOAT_WORD(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23));
- return exp_x;
+ exp_x = expf(x - kln2);
+ GET_FLOAT_WORD(hx, exp_x);
+ *expt = (hx >> 23) - (0x7f + 127) + k;
+ SET_FLOAT_WORD(exp_x, (hx & 0x7fffff) | ((0x7f + 127) << 23));
+ return exp_x;
}
-float complex __ldexp_cexpf(float complex z, int expt)
-{
- float x, y, exp_x, scale1, scale2;
- int ex_expt, half_expt;
+float complex __ldexp_cexpf(float complex z, int expt) {
+ float x, y, exp_x, scale1, scale2;
+ int ex_expt, half_expt;
- x = crealf(z);
- y = cimagf(z);
- exp_x = __frexp_expf(x, &ex_expt);
- expt += ex_expt;
+ x = crealf(z);
+ y = cimagf(z);
+ exp_x = __frexp_expf(x, &ex_expt);
+ expt += ex_expt;
- half_expt = expt / 2;
- SET_FLOAT_WORD(scale1, (0x7f + half_expt) << 23);
- half_expt = expt - half_expt;
- SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
+ half_expt = expt / 2;
+ SET_FLOAT_WORD(scale1, (0x7f + half_expt) << 23);
+ half_expt = expt - half_expt;
+ SET_FLOAT_WORD(scale2, (0x7f + half_expt) << 23);
- return CMPLXF(cosf(y) * exp_x * scale1 * scale2,
- sinf(y) * exp_x * scale1 * scale2);
+ return CMPLXF(cosf(y) * exp_x * scale1 * scale2,
+ sinf(y) * exp_x * scale1 * scale2);
}

Powered by Google App Engine
This is Rietveld 408576698