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

Side by Side Diff: fusl/src/math/scalbnf.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 unified diff | Download patch
OLDNEW
1 #include <math.h> 1 #include <math.h>
2 #include <stdint.h> 2 #include <stdint.h>
3 3
4 float scalbnf(float x, int n) 4 float scalbnf(float x, int n) {
5 { 5 union {
6 » union {float f; uint32_t i;} u; 6 float f;
7 » float_t y = x; 7 uint32_t i;
8 } u;
9 float_t y = x;
8 10
9 » if (n > 127) { 11 if (n > 127) {
10 » » y *= 0x1p127f; 12 y *= 0x1p127f;
11 » » n -= 127; 13 n -= 127;
12 » » if (n > 127) { 14 if (n > 127) {
13 » » » y *= 0x1p127f; 15 y *= 0x1p127f;
14 » » » n -= 127; 16 n -= 127;
15 » » » if (n > 127) 17 if (n > 127)
16 » » » » n = 127; 18 n = 127;
17 » » } 19 }
18 » } else if (n < -126) { 20 } else if (n < -126) {
19 » » y *= 0x1p-126f; 21 y *= 0x1p-126f;
20 » » n += 126; 22 n += 126;
21 » » if (n < -126) { 23 if (n < -126) {
22 » » » y *= 0x1p-126f; 24 y *= 0x1p-126f;
23 » » » n += 126; 25 n += 126;
24 » » » if (n < -126) 26 if (n < -126)
25 » » » » n = -126; 27 n = -126;
26 » » } 28 }
27 » } 29 }
28 » u.i = (uint32_t)(0x7f+n)<<23; 30 u.i = (uint32_t)(0x7f + n) << 23;
29 » x = y * u.f; 31 x = y * u.f;
30 » return x; 32 return x;
31 } 33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698