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

Side by Side Diff: fusl/src/math/ilogb.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 <limits.h> 1 #include <limits.h>
2 #include "libm.h" 2 #include "libm.h"
3 3
4 int ilogb(double x) 4 int ilogb(double x) {
5 { 5 PRAGMA_STDC_FENV_ACCESS_ON
6 » PRAGMA_STDC_FENV_ACCESS_ON 6 union {
7 » union {double f; uint64_t i;} u = {x}; 7 double f;
8 » uint64_t i = u.i; 8 uint64_t i;
9 » int e = i>>52 & 0x7ff; 9 } u = {x};
10 uint64_t i = u.i;
11 int e = i >> 52 & 0x7ff;
10 12
11 » if (!e) { 13 if (!e) {
12 » » i <<= 12; 14 i <<= 12;
13 » » if (i == 0) { 15 if (i == 0) {
14 » » » FORCE_EVAL(0/0.0f); 16 FORCE_EVAL(0 / 0.0f);
15 » » » return FP_ILOGB0; 17 return FP_ILOGB0;
16 » » } 18 }
17 » » /* subnormal x */ 19 /* subnormal x */
18 » » for (e = -0x3ff; i>>63 == 0; e--, i<<=1); 20 for (e = -0x3ff; i >> 63 == 0; e--, i <<= 1)
19 » » return e; 21 ;
20 » } 22 return e;
21 » if (e == 0x7ff) { 23 }
22 » » FORCE_EVAL(0/0.0f); 24 if (e == 0x7ff) {
23 » » return i<<12 ? FP_ILOGBNAN : INT_MAX; 25 FORCE_EVAL(0 / 0.0f);
24 » } 26 return i << 12 ? FP_ILOGBNAN : INT_MAX;
25 » return e - 0x3ff; 27 }
28 return e - 0x3ff;
26 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698